To lead you in the right direction:
You start with a page: order.php. In the head you will have get a variable (step) and depending upon that variable, different info will show up on the page.
So you set up order.php and give them all the pre-order information that they need (legal junk, basic comparative info, you know). They click on "Order Now" which links to order.php?step=1.
So your first few lines should look like:
<?php
// Include a document that contains all the functions for each step.
include($_SERVER['document_root'].'/scripts/orders.php');
if(!isset($_REQUEST['step'])){
// No step, point to a function that will display the original page.
basepage();
}
else{
// They're in the order process, but where?
$step = $_REQUEST['step'];
}
switch($step){
case "1":
/* They're at the beginning, let them fill in some basic info, then you submit it to the database */
break;
case "2":
/* Second step. They've got their info, now how about the product or what not? Once submitted, add it to the database */
break;
case "3":
/* Order verification. Just read the variables form the database */
break;
case "4":
/* Order receipt. Allow them to print a receipt for the order */
break;
}
After that switch function, you can jump out of PHP and set up your page as you like. Then where you want the info, just call the variable that you put all the information to, or the function.
Commented Example (Not functional):
<?php
// Include a document that contains all the functions for each step.
include($_SERVER['document_root'].'/scripts/orders.php');
if(!isset($_REQUEST['step'])){
function dispPage(){
step0();
}
}
else{
$step = $_REQUEST['step'];
}
switch($step){
case "1":
// Show the first form //
function dispPage(){
step1();
}
break;
case "2":
// First include a file to submit form submitted data to database //
include($_SERVER['document_root'].'/scripts/sub_order.php');
// Now show the page, the user demographics collection //
function dispPage(){
step2();
}
break;
case "3":
// Include the file to submit info to the DB //
include($_SERVER['document_root'].'/scripts/sub_order.php');
// Show the review page //
function dispPage(){
step3();
}
break;
case "4":
// Just read the info and parse as you need
function dispPage(){
step4();
}
break;
}
/*********************
*** Included Files ***
*********************/
// orders.php
function step0(){
// Display original page
echo 'Welcome to my store';
echo '<form action="order.php?step=1" method="post">';
}
function step1(){
// Display First Data collection
echo '<form action="order.php?step=2" method="post">';
}
function step2(){
// Display Second Data collection
echo '<form action="order.php?step=2" method="post">';
}
function step3(){
// Display Order Review
// Retrieve ONLY from the database
echo '<a href="order.php?step=4"><button value="Continue" border="0"></a>';
}
function step4(){
// Display Receipt
// Retrieve ONLY from the database
// Return to store front via link
}
//
// sub_order.php
//
global $step;
switch($step){
case "1":
// Submit first bits to database
break;
case "2":
// Submit second bits to database
break;
case "3":
// Submit third bits to database
break;
}
?>
<html>
<head><title></title></head>
<body>
<? dispPage(); ?>
</body>
</html>