Php help getting total price and number of boxes.....
Posted: Tue Feb 05, 2008 4:29 pm
I have a voucher page in html format that a user clicks on a price
and the number of vouchers
they want which are both select boxes to buy a particular voucher. I'm trying to use php codes to make this info user friendly to the customers. What i can't achieve is 2 things:
1) whatever price is selected and number of vouchers is selected - i'd like to have them displayed on the next page with the total price eg. if price is 50 and 2 vouchers selected total price is 100.
2) also i can't seem to figure out where to start if i want the number of vouchers selected in the previous page to come up in the next page so the customer can type in the details they want on the vouchers eg. if customer selects 2 vouchers, 2 different voucher boxes like comes up in the next page. or if the customer selects 3 voucher, 3 voucher boxes comes up. and so on.
I've tried to use $_POST but i don't get the total with that and i can't post the info for 3 pages in a row(only one). Can you please help as i've been spending 3 days trying to figure this out.
Code: Select all
<select name='price' id='price'>
<option value='Price'>Choose Amount</option>
<option value='50'>50 EURO</option>
<option value='100'>100 EURO</option>
<option value='150'>150 EURO</option>
<option value='200'>200 EURO</option>
<option value='250'>250 EURO</option>
<option value='300'>300 EURO</option>
<option value='350'>350 EURO</option>
<option value='400'>400 EURO</option>
<option value='450'>450 EURO</option>
<option value='500'>500 EURO</option>
</select>Code: Select all
<select name='quantity' id='quantity'>
<option value='0'>None</option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
</select>1) whatever price is selected and number of vouchers is selected - i'd like to have them displayed on the next page with the total price eg. if price is 50 and 2 vouchers selected total price is 100.
2) also i can't seem to figure out where to start if i want the number of vouchers selected in the previous page to come up in the next page so the customer can type in the details they want on the vouchers eg. if customer selects 2 vouchers, 2 different voucher boxes like
Code: Select all
<td><p style="font-weight:bold">Presented To</p> <i>(printed on voucher)</i></td>
<td>
<input type="text" name="presentedto" size="40" /><b style="color:#FF0000">*</b>
</td>
</tr>
<tr>
<td class="formtd"><p style="font-weight:bold">Presented By</p><i>(printed on voucher)</i></td>
<td><input type="text" name="presentedby" size="40" />
<b style="color:#FF0000">*</b>
</td>
</tr>
<tr>
<td class="formtd"><p style="font-weight:bold">Dedication</p><i>(printed on voucher)</i></td>
<td><textarea rows="8" cols="40" name="dedication"></textarea>
<b style="color:#FF0000">*</b>
</td>
</tr>
<tr>
<td style="font-weight:bold"><p>Address</p></td>
<td>
<input type="text" name="address" size="20" />
</td>
</tr>
<tr>
<td><i>(voucher posted to)</i></td>
<td>
<input type="text" name="address2" size="20" />
</td>
</tr>
<tr>
<td></td>
<td>
<input type="text" name="address3" size="20" />
</td>
</tr>
<tr>
<td style="font-weight:bold"><p>Email</p></td>
<td>
<input type="text" name="emailother" size="20" />
</td>
</tr>
<tr>
<td><i>(voucher emailed to)</i></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><b style="color:#cc0033"><i>Voucher 2 Details:</i></b></td>
<td> </td>
</tr>
<tr>
<td><p style="font-weight:bold">Presented To</p> <i>(printed on voucher)</i></td>
<td>
<input type="text" name="presentedto2" size="40" />
</td>
</tr>
<tr>
<td class="formtd"><p style="font-weight:bold">Presented By</p><i>(printed on voucher)</i></td>
<td><input type="text" name="presentedby2" size="40" />
</td>
</tr>
<tr>
<td class="formtd"><p style="font-weight:bold">Dedication</p><i>(printed on voucher)</i></td>
<td><textarea rows="8" cols="40" name="dedication2"></textarea> </td>
</tr>
<tr>
<td style="font-weight:bold"><p>Address</p></td>
<td>
<input type="text" name="address12" size="20" /> </td>
</tr>
<tr>
<td><i>(voucher posted to)</i></td>
<td>
<input type="text" name="address22" size="20" /> </td>
</tr>
<tr>
<td></td>
<td>
<input type="text" name="address32" size="20" /> </td>
</tr>
<tr>
<td style="font-weight:bold"><p>Email</p></td>
<td>
<input type="text" name="emailother2" size="20" /> </td>
</tr>
<tr>
<td><i>(voucher emailed to)</i></td>
<td> </td>
</tr>I've tried to use $_POST but i don't get the total with that and i can't post the info for 3 pages in a row(only one). Can you please help as i've been spending 3 days trying to figure this out.