two pieces of advice:
1: go find any post by volka and read the link in his sig. (trust me, this is useful info to know that he has in that link)
2: why not use one self-processing php file so that you can extend upon the form to include user info that's needed for the sale and make sure you have everything? ie: instead of those two, use this...
note: i changed $HTTP_POST_VARS to $_POST because as of, i believe 4.1.0, the former is deprecated, and it may not be supported much longer. if i'm wrong, then i'm confusing this switch and the register globals one... one is 4.0.6 and the other 4.1.0
Code: Select all
<?php
/* put all include calls here; all pages that have the same begining should use a variable in an include file... easier future maintainence */
if(isset($_POST['verify'])){ # this is not the user entered something
$startpg=pgstart($_POST['name']); # page with title customized to person's name
$procdate=date("H:i, jS F"); # date of order processing
$endpg=pgend(); # function to end the page giving all disclaimer, etc, and if you want give an argument and personalize it
echo <<<END
$startpg
<h1>Bob's Auto Parts</h1>
<h2>
Order Results
<form action="{$_SERVER['PHP_SELF']}" method="POST">
<p>Order processed at: $procdate
</p>
<p>Your order is as follows:
<br />Tires: <input type="text" name="tireqty" value="{$_POST['tireqty']}">
<br />Oil: <input type="text" name="oilqty" value="{$_POST['oilqty']}">
<br />Spark Plugs: <input type="text" name="sparkqty" value="{$_POST['sparkqty']}">
</p>
<p>Customer billing information (please verify)
<br /><!-- put your customer billing information here -->
</form>
</h2>
$endpg
END;
elseif(isset($_POST['complete'])){ // display when we're sure that we have what the customer wants, and the billing info is right
$startpg=pgstart($_POST['name']); # page with title customized to person's name
$procdate=date("H:i, jS F"); # date of order processing
$endpg=pgend(); # function to end the page giving all disclaimer, etc, and if you want give an argument and personalize it
echo <<<END
$startpg
<h1>Bob's Auto Parts</h1>
<h2>
Order Results
<p>Order processed at: $procdate
</p>
<p>Your order is as follows:
<br />Tires: {$_POST['tireqty']}
<br />Oil: {$_POST['oilqty']}
<br />Spark Plugs: {$_POST['sparkqty']}
</p>
<p>Customer billing information (please verify)
<br /><!-- put your customer billing information here -->
</form>
</h2>
$endpg
END;
}else{ // first time calling the form
$startpg=pgstart(new customer); # page with title customized to person's name
$procdate=date("H:i, jS F"); # date of order processing
$endpg=pgend(); # function to end the page giving all disclaimer, etc, and if you want give an argument and personalize it
echo <<<END
$startpg
<form action="{$_SERVER['PHP_SELF']}" method="POST">
<table border=0>
<tr bgcolor=#cccccc>
<td width=150>Item</td>
<td width=15>Quantity</td>
</tr>
<tr>
<td>Tires</td>
<td align=center><input type="text" name="tireqty" size=3 maxlength=3></td>
</tr>
<tr>
<td>Oil</td>
<td align=center><input type="text" name"oilqty" size=3 maxlength=3></td>
</tr>
<tr>
<td>Spark Plugs</td>
<td align=center><input type="text" name"sparkqty" size=3 maxlength=3></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value="Submit Order"></td>
</tr>
</table>
</form>
$endpg
END;
}
?>
i should explain some things:
1: there's no reason to ever leave php, so i didn't. 2: i use the "heredoc" syntax of echo (for more info, please see the source ofphp, php.net, and search for echo)
2: there's no begining and ending because i figure you will make that in an include file, and then convert the site to php since you can then maintain the entire ite easier (i know i would do that)
3: i do NOT use <br> since that's html and html itself is going to be deprecated soon for XHMTL. i use <br /> since it's xhtml
similarly, i closed off a bunch of open ended tags because even though html is very forgiving and doesn't care, xhtml is not and cares a lot