Jump to content

My form doesn't work, please help


razzor

Recommended Posts

Here's my problem, I built an HTML form to process my order using html kit. Now when I plug in numbers in my form, a new browser opens up and spits out all the code from my "processorder.php" including all my html tags. What can I do to make my form process my order?

Thanks,

 

Here's a look at what I get once hit submit:

 



<html>
   <head>
      <title>Bob's Auto Parts - Order Results</title>
   </head>
   <body>
       <h1>Bob's Auto Parts</h1>
       <h2>Order Results</h2>


            <?php 
	//create short variable names
		$tireqty=$_POST['tireqty'];
		$oilqty=$_POST['oilqty'];
		$sparkqty=$_POST['sparkqty'];
	//variable declarations
		$totalqty=0;
		$totalamount=0.00;
	//constant definitions
		define ('TIREPRICE',100);
		define ('OILPRICE',10);
		define ('SPARKPRICE',4);

		$totalqty=0;
		$totalqty=$tireqty + $oilqty+$sparkqty;
		$totalamount =$tireqty*TIREPRICE
			  +$oilqty*$OILPRICE
  			+$sparkqty*SPARKPRICE;

		$taxrate = 0.1; //local tax rate is 10%
		$totalamount=$totalamount * (1+$taxrate);



		echo 'isset($tireqty): '.isset($tireqty).'<br />';
		echo 'isset($nothere): '.isset($nothere).'<br />';



		echo '<p>Order processed at ';
		echo date('H:i, jS F');
		echo '</p>';

		echo '<p>Your order is as follows: </p>';
		echo $tireqty.' tires<br />';
		echo $oilqty.' bottles of oil<br />';
		echo $sparkqty.' spark plugs<br />';


		echo 'Items ordered: '.$totalqty.'<br />';
		echo 'Subtotal: $'.number_format($totalamount,2).'<br />';
		echo 'Total including tax: $'.number_format($totalamount,2).'<br />';

?>


   </body>
</html>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/39737-my-form-doesnt-work-please-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.