编码/形成问题 [英] Coding/form problem
问题描述
嗨。
我刚刚学习Php的初期阶段,只需要一个
的小帮助。
我有一个包含价值观的表格。但是,当我测试它时,
值不会被累加并传送到结果页面。我只是
想知道你是否能发现它有什么不对吗?
这是页面上的表格tourprice.php:
< form name =" frm_tourprice" ID = QUOT; frm_tourprice" method =" post"
action =" tourprice_processor.php">
< table width =" 60%"边界=" 0" CELLSPACING = QUOT; 0" cellpadding =" 3">
< tr>
< td>成人人数< / td>
< td>< input name =" numAdults"类型= QUOT;文本" id =" numAdults"
/>< / td>
< / tr>
< tr>
< td>子女数< / td>
< td>< input name =" numChildren"类型= QUOT;文本" id =" numChildren"
/>< / td>
< / tr>
< tr>
< td>旅游名称< / td>
< td>< select name =" tourName" id =" tourName">
< option value =" 500">阿根廷的亮点< /选项>
< option value =" 700" ;>加拿大西部的亮点< /选项>
< option value =" 900">埃及金字塔和更多< / option>
< / select> ;< / td>
< / tr>
< tr>
< td>& nbsp;< / td>
< td>< input type =" submit"命名= [提交" value =" Submit"
/>< / td>
< / tr>
< / table>
< / form>
在tourprice_calculator.php页面上,它应该根据您选择的内容添加所有内容
up给你正确的费用。我保持
虽然返回零。
这是在tourprice_calculator.php的顶部
< ;?php
$ numAdult = $ _POST [''numAdults''];
$ numChild = $ _POST [''numChildren''];
$ basePrice = $ _POST [''tourName''];
$ tourPrice =(numAdult * basePrice)+(numChild * basePrice)
?>
继续在页面上我有以下内容:
旅游价格计算器< / h1>
< ; p>您的旅行的估计费用是< strong><?php echo
$ tourPrice; ?>< / strong>。< / p>
< p>价格包括酒店,住宿和旅行费用
。它们不包括到起始目的地的机票。< / p>
< p>< a href =" tourprice.php"> Calculate< / a>另一个旅游。< / p>
< p>< a href =" contact.php">联系< / a>我们的合格
代理商之一。< / p>
非常感谢您的帮助。我对这个有点困惑。我认为它可能是一些字符串,如$ Adult $ Adults $ Children
$ Child等错误,但当我尝试更改它时仍然
为零。
John
Hi.
I am just in the very early stages of learning Php and just need a
little help.
I have a form which includes values. However when I test it, the
values are not added up and carried to the results page. I just
wondered if you can spot whats wrong with it?
This is the form on the page tourprice.php:
<form name="frm_tourprice" id="frm_tourprice" method="post"
action="tourprice_processor.php">
<table width="60%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>Number of Adults </td>
<td><input name="numAdults" type="text" id="numAdults"
/></td>
</tr>
<tr>
<td>Number of Children </td>
<td><input name="numChildren" type="text" id="numChildren"
/></td>
</tr>
<tr>
<td>Tour Name </td>
<td><select name="tourName" id="tourName">
<option value="500">Highlights of Argentina</option>
<option value="700">Highlights of Western Canada</option>
<option value="900">Egyptian Pyramids and More</option>
</select></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"
/></td>
</tr>
</table>
</form>
On the tourprice_calculator.php page it is supposed to add everything
up depending on what you select and give you the correct cost. I keep
getting a zero returned though.
This is at the top of tourprice_calculator.php
<?php
$numAdult = $_POST[''numAdults''];
$numChild = $_POST[''numChildren''];
$basePrice = $_POST[''tourName''];
$tourPrice = (numAdult * basePrice) + (numChild * basePrice)
?>
Further down on the page I have the following:
Tour Price Calculator </h1>
<p>The estimated cost of your tour is <strong><?php echo
$tourPrice; ?></strong>.</p>
<p>Price includes hotel, accommodation, and travel expenses during
the tour. They do not include airfare to the starting destination.</p>
<p><a href="tourprice.php">Calculate</a> another tour.</p>
<p><a href="contact.php">Contact</a> one of our qualified
agents.</p>
Thanks very much for any help. Im a little confused with this one. I
thought it might be some of the strings like $Adult $Adults $Children
$Child etc that were wrong, but when I tried changing those it still
comes up as zero.
John
推荐答案
numAdult =
numAdult =
_POST [''numAdults''];
_POST[''numAdults''];
numChild =
numChild =
这篇关于编码/形成问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!