Jump to content

Beginer form help


Jpower24

Recommended Posts

I have this code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>

<?php
if(isset($_POST['cost']) && ($_POST['cost'] != 0)){
	$cost = $_POST['cost'];
	$gst = $cost*0.06;
	$pst = $cost*0.08;
	$cost += $gst + $pst;
	echo "<h1>Total Cost: $".$cost."</h1>";
};
?>

<form action= method="post">
<label for="cost">Cost: $</label>
<input type="text" name="cost" id="cost" />
<input type="submit" value="Calculate GST" />

Color:

<select name="color">
<option value="Blue Transparent ">Blue Transparent </option>
<option value="Green Transparent ">Green Transparent )</option>
<option value="Yellow Transparent ">Yellow Transparent </option>
<option value="Red Transparent ">Red Transparent </option>
</select>

<b>Size</b>

<select name="Size">
<option value=" 8 inches ">8 inches </option>
<option value="12 inches ">12 inches</option>
<option value="24 inches ">24 inches</option>
<option value="36 inches ">36 inches</option>
</select>




<b>Quantity</b><input type="text" name="Quantity" value="">
<b>Name</b><input type="text" name="Name" value="">
<b>Address</b><input type="text" name="Address" value="">
<b>Province</b><input type="text" name="Province" value="">
<b>City</b><input type="text" name="City" value="">

<input type="hidden" name="recipient" value="[email protected]">
<input type="hidden" name="redirect" value="">
<input type="hidden" name="required" value="">
<input type="hidden" name="env_report" value="REMOTE_HOST, HTTP_USER_AGENT">



</body>
</html>

 

What do I have to do to make cost show up when you select an option (such as size). And how do I assign a cost value to each option in the selector(size)

 

Appreciate the help

Link to comment
https://forums.phpfreaks.com/topic/43019-beginer-form-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.