php表单上的奇怪编码字符
我试图学习PHP表单,输入数据,用一个按钮在一个基本的html表单页面上输出结果。然而,它并没有将我发送到正确的PHP链接,而是显示了一个断开的404 not found链接,并且似乎我在apache上遇到了一些奇怪的编码问题 我甚至把它上传到我的主机上,我得到了更奇怪的链接编码,这个链接的名字应该是php表单上的奇怪编码字符,php,encoding,Php,Encoding,我试图学习PHP表单,输入数据,用一个按钮在一个基本的html表单页面上输出结果。然而,它并没有将我发送到正确的PHP链接,而是显示了一个断开的404 not found链接,并且似乎我在apache上遇到了一些奇怪的编码问题 我甚至把它上传到我的主机上,我得到了更奇怪的链接编码,这个链接的名字应该是handle\u calc.php 在该服务器上找不到请求的URL/Ã、ā、ā“handle_calc.php、Ã、ā” 有什么需要更改的提示吗?我很惊讶这两种环境在默认情况下都不能正确显示基本的p
handle\u calc.php
在该服务器上找不到请求的URL/Ã、ā、ā“handle_calc.php、Ã、ā”
有什么需要更改的提示吗?我很惊讶这两种环境在默认情况下都不能正确显示基本的php表单
html
产品成本计算器
填写此表以计算总成本:
价格:
数量:
折扣:
税款:(%)
装运方式:
缓慢而稳定
快点。
我昨天需要它!
要支付的付款数量:
php:
产品成本计算器
.number{字体大小:粗体;}
您的表单操作属性使用的是特殊字符,而不是标准双引号。您在整个过程中似乎都在使用特殊字符。请将所有出现的特殊字符替换为常规双引号/单引号。至少显示表单代码确保。我想这不是问题所在的编码。我现在将进行修订,因为它的l伊夫(?)一个url来查看它会很好,我真的认为它必须在不同的环境中复制和粘贴代码几次。这是我的猜测。嗯,真奇怪,我的文本编辑器几乎没有显示任何差异。我不知道这是怎么回事。我想我需要一个新的文本编辑器哈哈。thanks@Wilson-试试记事本++,个人我使用EclipsePDT
<!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>
<!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>