ボタンを使って基本的なhtmlフォームページに結果を出力して、PHPフォームを学習しようとしています。しかし、それは私を正しいPHPリンクに送りません。代わりに404のリンクが見つからないという壊れたリンクが表示されています。これはApacheのエンコードに関する奇妙な問題があるようです。PHPフォームに奇妙なエンコーディング文字があります
私も私のホスティングにこれをアップロードし、私は単にhandle_calc.php
要求されたURL/ââ,¬Å"handle_calc.phpâ名前を付けることになっているリンクの更なる奇妙なエンコーディングを取得しますこのサーバーでは見つかりませんでした。
何を変更する必要がありますか?私は両方の環境がデフォルトでphpを正しく表示しないことに驚いています。
HTML
<!doctype html>
<html lang=“en”>
<head>
<meta charset=“utf-8”>
<title>Product Cost Calculator</title>
</head>
<body>
<div><p>Fill out this form to calculate the total cost:</p>
<form action=“handle_calc.php” method=“post”>
<p>Price: <input type=“text” name=“price” size=“5”></p>
<p>Quantity: <input type="number" name=“quantity” size=“5” min=“1”
value=“1”></p>
<p>Discount: <input type=“text” name=“discount” size=“5”></p>
<p>Tax: <input type=“text” name=“tax” size=“5”> (%)</p>
<p>Shipping method: <select name=“shipping”>
<option value=“5.00”>Slow and steady</option>
<option value=“8.95”>Put a move on it.</option>
<option value=“19.36”>I need it yesterday!</option>
</select></p>
<p>Number of payments to make: <input type="number" name="payments" size=“5”
min=“1” value=“1”></p>
<input type="submit" name="submit" value="Calculate!">
</form>
</div>
</body>
</html>
PHP:
<!doctype html>
<html lang=“en”>
<head>
<meta charset=“utf-8”>
<title>Product Cost Calculator</title>
<style type=“text/css”>
.number { font-weight: bold; }
</style>
</head>
<body>
<?php
//get the values from the $_POST array
$price = $_POST[‘price’];
$quantity = $_POST[‘quantity’];
$discount = $_POST[‘discount’];
$tax = $_POST[‘tax’];
$shipping = $_POST[‘shipping’];
$payments = $_POST[‘payments’];
//calculate the total:
$total = $price * $quantity;
$total = $total + $shipping;
$total = $total - $discount;
//determine tax rate
$taxrate = $tax/100;
$taxrate = $taxrate + 1;
//factor in the tax rate:
$total = $total * $taxrate;
//calculate the monthly payments
$monthly = $total/$payments
//print out results
print “<p>You have selected to purchase:<br>
<span class=\”number\”>$quantity</span> widget(s) at <br>
$<span class=\”number\”>$price</span>price each plus a <br>
$<span class=\”number\”>$shipping</span>shipping cost and a <br>
<span class=\”number\”>$tax</span>percent tax rate.<br>
After your $<span class=\”number\”>$discount</span>discount, the total cost
is $<span class=\”number\”>$total</span>.<br>
Divided over <span class=\”number\”>$payments</span>monthly payments, that
would be $<span class=\”number\”>$monthly</span> each.</p>”;
?>
</body>
</html>
少なくとも、フォームコード – rtfm
を表示してください。それが問題だったコーディングではないと考えました。今 – Wilson
病気改定そのライブ(?)それは – rtfm