Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 1, 2026.

Form design need help with quantity and adding

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
NamecheapNamecheap
Watch

havoc2005

New Member
Impact
0
So Ive created a form on a website involving ticket sales, I want customers to be able to choose the quantity that they want to purchase, and then I want to be able to echo/display the total in the confirmation page.


Here is what I have down for the forum

<td><select name="Payment_Type" size="1" id="Payment_Type" tabindex="27">
<option value="None">-- Charge Amount --</option>
<option value="General Admission $25">General Admission $25</option>
<option value="VIP Seating $75">VIP Seating $75</option>
</select>
<label for="quantity">Qty:</label>

<input id="Quantity" name="Quantity" type="text" size="3" />
</td>


It consists of two ticket choices and a quantity field. When they choose one and then a quantity I want the next page aka the confirmation page to total it up.

<?php echo $_POST["Payment_Amount"];
#if ($_POST["Payment_Amount"].Value=="One") echo "$59.40 USD";
#else if ($_POST["Payment_Amount"].Value=="Two") echo "$98.00 USD"; ?>





This is an older form for a previous function that I am editing hence the weird prices of 98.00 and 59.40

Please reedit this for me so the user can choose the ticket type, either 25 dollars or 75 dollars, choose a quantity then submit to the confirmation page. And on the confirmation page it adds up the amount + quantity and echo's it back on the display.

How would I go about doing that?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Something more like this will do the trick:

Change your select code to this because you want the actual value to be a number so you can do the math:

Code:
<select name="Payment_Type" size="1" id="Payment_Type" tabindex="27">
<option value="None">-- Charge Amount --</option>
<option value="25">General Admission $25</option>
<option value="75">VIP Seating $75</option>
</select>

Then here is the php code to calculate the total

Code:
<?php
if (isset($_POST['Payment_Type']) && isset($_POST['Quantity'])) {
 $total = $_POST['Payment_Type'] * $_POST['Quantity'];
 echo "Total: " . $total;
}
?>
 
0
•••
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back