我有表单和 php,表单询问用户他想买什么,用户选择并添加它,我想要它,以便在单击提交按钮时,存储在 php 变量中的数据显示在提交按钮下方,但我不知道该怎么做!
<p><b>Billing Information</b></p>
<form action="" method="get">
<p>Name:
<input type="text" name="firstname">
<br>
<strong>Items:</strong></p>
</form>
<form id="form1" method="post" action="">
<p>
<input type="checkbox" name="one" value= "2.39"/>
<label for="one">Four 100-watt light bulbs for $2.39</label>
<p>
<input type="checkbox" name="two" value= "4.29"/>
<label for="two">Eight 100-watt light bulbs for $4.29</label>
<p>
<input type="checkbox" name="three" value= "3.95"/>
<label for="three">Four 100-watt long-life light bulbs for $3.95</label>
</p>
<p>
<input type="checkbox" name="four" value= "7.49"/>
<label for="four">Eight 100-watt long-life light bulbs for $7.49</label>
</p>
<input name="battery" name = "battery" type="number" id="battery" size="1" maxlength="3" />
<label for="battery">Battery Packs Checkbox $10.42 each:</label>
</p>
<p><strong><b>Card Details</b>:</strong></p>
<p>
<?php
if(isset($_POST['value']))
{
$one = $_POST['one'];
$two = $_POST['two'];
$three = $_POST['three'];
$four = $_POST['four'];
$five = $_POST['battery'];
$total = $one + $two + $three + $four + $battery;
$interest = $total * 0.175;
echo "Total cost is " .$total;
}
?>
</p>
<p>
<p>
<input name="Visa" type="radio" value= <?php $cardone = "Visa"; ?>
<p>Visa</p>
<p>
<input name="Mastercard" type="radio" value= <?php $cardtwo = "Mastercard"; ?>
<p>Mastercard</p>
<p>
<input name="American" type="radio" value=<?php $cardthree = "American Express"; ?>
<p> American Express </p>
<p>
<?php
if(isset($_POST['value']))
{
$cardone = $_POST['cardone'];
$cardtwo = $_POST['cardtwo'];
$cardthree = $_POST['cardthree'];
$total = $cardone + $cardtwo + $cardthree;
echo "You have chose to pay using a " .$total;
}
?>
<input type="Submit" name="SubmitForm" value="Submit">
<form action="Results.php" method="post">
<input name="Submit" type="button" />
</p>
</form>
对不起,如果这没有出来,但 HTML 的东西不是很好。请帮我!