Click to See Complete Forum and Search --> : Check boxes. Total their values and say outcome


tom8521
05-21-2007, 08:43 AM
I am rather stuck.

I have some check boxes that enable a user to chose some items they wish to purchase.

The user should be able to tick the boxes, press submit on the form and it bring back...

The name of the item they ticked, and the price totalling all items.

It uses some PHP, can anyone show me how this is done?
It should total a value from the drop down box, and any of the additional check box extras.

Please hurry, i need this handed in for 3.30!!

Thanks

---------------------------
HERE IS MY FORM CODE


<form action="return.php" method="get">
<h5><b>Please Select your camel (Click and select from the drop down list):</b></h5>

<select name="camel" size="1">
<option value="Male Bactrian Camel">Male Bactrian Camel</option>
<option value="Female Bactrian Camel">Female Bactrian Camel</option>
<option value="Male Dromedary Camel">Male Dromedary Camel</option>
<option value="Female Dromedary Camel">Female Dromedary Camel</option>
</select>


<h5><b>Please select any extras you require by ticking the boxes below:</b></h5>
<h6>
Triple strength breath mints
<input type="checkbox" name="extras" value="Triple strength breath mints" checked="checked" />
<br />
<br />

Foot File
<input type="checkbox" name="extras1" value="Foot file" />
<br />
<br />

Genuine Leather Saddle
<input type="checkbox" name="extras2" value="Genuine Leather Saddle" />
<br />
<br />

Top quality straw
<input type="checkbox" name="extras3" value="Top Quality Straw" />
<br />
<br />

Extra large shovel
<input type="checkbox" name="extras4" value="Extra Large Shovel" />
</h6>

<h5><b>How would you like to be contacted with your camel details? (Select one option from below)</b></h5>
<h6>
Post
<input type="radio" name="contact" value="Post" />
<br />
Email
<input type="radio" name="contact" value="Email" />
<br />
SMS
<input type="radio" name="contact" value="SMS" />
<br />
<br />
</h6>
<h5><b>Please enter some additional details so we can contact you:</b></h5>
<h6>
First Name:
<input type="text" name="fname" value="" maxlength="25" />
<br />
<br />
Last Name:
<input type="text" name="lname" value="" maxlength="25" />
<br />
<br />
Email Address:
<input type="text" name="email" value="" maxlength="45" />
<br />
<br />
Phone Number:
<input type="text" name="phone" value="" maxlength="15" />
<br />
<br />

Address:
<textarea rows="6" cols="35" name="address" wrap="physical">Enter address inc post code here</textarea>

</h6>
<input type="submit" value="Submit" />


----------------------------------------

HERE IS MY PHP CODE

<?php
$camel = $_GET['camel'];

echo "<p><b><h5>You have chosen a: </b><br/><br/><h6>$camel</h6></p>";


$extras = $_GET['extras'];

echo "<p><b><h5>The extras you have chosen are:</h5></b><br/><br/><h6>$extras</h6>";


$extras1 = $_GET['extras1'];

echo "<br/><h6>$extras1</h6>";


$extras2 = $_GET['extras2'];

echo "<br/><h6>$extras2</h6>";


$extras3 = $_GET['extras3'];

echo "<br/><h6>$extras3</h6>";


$extras4 = $_GET['extras4'];

echo "<br/><h6>$extras4</h6>";


$contact = $_GET['contact'];

echo "<p><b><h5>You have chosen to be contacted via:</h5> </b><br/><br/><h6>$contact</h6></p>";


$fname = $_GET['fname'];

echo "<b><h5>Name:</h5></b><br/><br/><h6>$fname</h6><br/>";


$lname = $_GET['lname'];

echo "<h6>$lname</h6><br/>";


$email = $_GET['email'];

echo "<p><b><h5>Email:</h5></b><br/><br/><h6>$email</h6><br/>";


$phone = $_GET['phone'];

echo "<p><b><h5>Phone:</h5></b><br/><br/><h6>$phone</h6><br/>";


$address = $_GET['address'];

echo "<p><b><h5>Address:</h5></b><br/><br/><h6>$address</h6><br/>";


?>