Jump to content

Statement now printing!!!


ZeroShade

Recommended Posts

When the form is submitted with everything filled out... it won't print out the info() function... well... it does but without the stored information... why is this?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">		<head>				<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />				<title>CompuDeal</title>				<link rel="stylesheet" href="styles.css" type="text/css" />		</head>		<body>				<h1>CompuDeal</h1>				<div id="text">										 		<p />Welcome to CompuDeal! Please fill out the form below to order a computer product. Our form is simple and fool proof to use. And our prices are the cheapest ever!								</div>								<form action="submit.php" method="post">						<fieldset id="personal">								<legend>Personal Information</legend>								<h3>Please fill in your shipping information</h3>								<label>First Name:</label><input type="text" name="fName" id="fName" />								<br /><label>Last Name:</label><input type="text" name="lName" id="lName" />								<br /><label>Address:</label><input type="text" name="address" id="address" />								<br /><label>City:</label><input type="text" name="city" id="city" />								<br /><label>Province/State:</label><input type="text" name="province" id="province" />								<br /><label>Country: </label><input type="text" name="country" id="country" />								<br /><label>Postal/Zip Code:</label><input type="text" name="postal"id="postal" />								<br /><label>Phone Number:</label><input type="text" name="number" id="number" />						</fieldset>												<fieldset id="specs">														<legend>Computer Specs</legend> 								<h3>Please select your computer parts</h3>																<p />PC = $500, Notebook = $700, Workstation = $800								<p />Computer:								<select name="computer" id="computer">										<option value="c1">PC</option>										<option value="c2">Notebook</option>										<option value="c3">Workstation</option>								</select>								<p />Speed:								<select name="proc" id="proc">										<option value="$a188">AMD Athlon 1.88GHz</option>										<option value="$a200">AMD Athlon 2.00GHz</option>										<option value="$t220">AMD Turion 2.20GHz</option>										<option value="$o188">AMD Opteron 1.88GHz</option>										<option value="$o200">AMD Opteron 2.00GHz</option>								</select>								<p />Memory:								<select name="memory">										<option value="m1">512MB</option>										<option value="m2">1GB</option>										<option value="m3">2GB</option>								</select>								<p />Space:								<select name="space">										<option value="h1">80GB</option>										<option value="h2">160GB</option>										<option value="h3">320GB</option>								</select>								<p />Color:								<select name="color">										<option value="color1">Black</option>										<option value="color2">Clear</option>										<option value="color3">Blue</option>								</select>								<p />Quantity:										<input type="text" name="quantityNumber" value="1" size="1" maxlength="3" />								<p />All computers are fully loaded and have NVIDIA 7900 GS 256MB graphic cards.												</fieldset>												<fieldset id="payment">														<legend>Payment Details</legend>								<h3>Please select payment methods</h3>								<p />Shipping Method:								<select name="ship">										<option value="express">Express Shipping</option>										<option value="fedex">Fedex</option>										<option value="airmail">Airmail</option>								</select>								<p />Payment Method:								<select name="pay">										<option value="masterCard">MasterCard</option>										<option value="visa">Visa</option>										<option value="electronic">Electronic</option>										<option value="cheque">Cheque</option>								</select>																<input type="submit" value="Place Order!" id="submit" />								</fieldset>								</form>								<div id="pic">										 		<img src="pics/computer.gif" alt="" />								</div>		</body></html>

<!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>CompuDeal Order</title>				<link rel="stylesheet" href="styles.css" type="text/css">		</head>		<body>							 	<?php						 $fName = $_POST['fName'];										 $lName = $_POST['lName'];										 $address = $_POST['address'];					 $city = $_POST['city'];					 $province = $_POST['province'];					 $country = $_POST['country'];					 $postal = $_POST['postal'];					 $number = $_POST['number'];					 $computer = $_POST['computer'];					 $proc = $_POST['proc'];					 $memory = $_POST['memory'];					 $space = $_POST['space'];					 $color = $_POST['color'];					 $quantityNumber = $_POST['quantityNumber'];					 $ship = $_POST['ship'];					 $pay = $_POST['pay'];										 $day = date + 7;															   if(empty($fName)) 					 				echo "<p />Please fill in your first name.";							   if(empty($lName))							   				echo "<p />Please fill in your last name.";							   if(empty($address))										echo "<p />Please fill in your address.";							   if(empty($city))										echo "<p />Please fill in your city.";							   if(empty($province))										echo "<p />Please fill in your province.";							   if(empty($country))										echo "<p />Please fill in your counrty.";							   if(empty($postal))										echo "<p />Please fill in your postal/zip code.";							   if(empty($number))										echo "<p />Please fill in your phone number.";							   if(empty($quantityNumber) || $quantityNumber == 0)										echo "<p />Please fill in your quantity.";								  							   if(!empty($fName) && !empty($lName) && !empty($address) && !empty($city) && !empty($province) && !empty($country) && !empty($postal) && !empty($number) && (!empty($quantityNumber) || $quantityNumber > 0))										echo info();								  							   function info()							   {										echo "<p />Thank you for purchasing from CompuDeal! This is your order.";														echo "<br />Your personal information is:";														echo "<ul><li>", $fName, "</li><li>", $lName, "</li><li>", $address, "</li><li>", $city, "</li><li>", $province, "</li><li>", $country, "</li><li>", $postal, "</li><li>", $number, "</li></ul>";														echo "<br />Your computer information is:";														echo "<br /><ul><li>", $computer, "</li><li>", $proc, "</li><li>", $memory, "</li><li>", $space, "</li><li>", $color, "</li><li>", $quantityNumber, "</li></ul>";														echo "<br />Your shipping information is:";														echo "<ul><li>", $ship, "</li><li>", $pay, "</li></ul>";														echo "<br />The price including GST & PST is:";																												if($computer == "PC")											  echo "$", ((500 * $quantityNumber) * (1.06 + 1.08));							  else if($computer == "Notebook")										  echo "$", ((700 * $quantityNumber) * (1.06 + 1.08));							  else if($computer == "Workstation")										echo "$", ((800 * $quantityNumber) * (1.06 + 1.08));																												echo "<p />You can expect your new computer on ", $day;														echo "<h1>Thank You for shopping with us!!</h1>";							   }								?>		</body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...