Photo-Graffix -> Checkout Page.

  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Jan 06, 2006
  • Posts: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Post June 23rd, 2007, 9:17 am

Hi all,

I need to write up a simple checkout page in php. But this will need to be 'connected' in a 'variable sense' with photo-graffix gallery.

I have some code but very little, that's why I am here for some help.

Ok, first I would download a demo of the program (unless you that good, and don't need it)...

I have a demo of Photo-Graffix 3.3

Code: [ Select ]
http://www.photo-graffix.com/trial.php


Ok, to begin...

To get a variable to be echoed out to the 'checkout.php' page using photo-graffix is like such:

Where ever you put this code in the checkout.php page:
Code: [ Select ]
<?php $name = $_GET['photoname']; echo $name ?>


It will display the name of the image name that you specify on the url string such as 'YourPic' (without the quotes) as specified in the url below.

Code: [ Select ]
http://www.yourdomain.com/graffix/checkout.php?photoname=YourPic


Note: YourPic (as specified in the above url) can be anything, I will use it for the item number for each image in the gallery. Also, if anyone has another suggestion for the url above that will substitute 'YourPic' for a variable based on the image clicked on in the gallery (not sure if photo-graffix works like that), but that would be awesome if you found out, so I don't have to type in each item number for each url. But if need be, I will do it.

Now I also would need the description to be echoed out onto the checkout page as well, keep in mind this is only a basic checkout page, so not to be technical. Now I haven't tested the code below so I don't know if it works, but I will need the description as well to be echoed to the checkout page. This code was emailed to me from photo-graffix, they said it works. I haven't tested it yet though.

Code: [ Select ]
http://www.yourdomain.com/gallery/checkout.php?item=photoname&description=photodescr


Now that you know that, a basic checkout page may look like this:

HTML Code: [ Select ]
<!-- CONTENT STARTS -->
<p align="center"><font face="Verdana">Checkout Page</font></p>
<table border="0">
   <tr>
      <td><font face="Verdana" size="2">&nbsp;Item Name:&nbsp; <?php $name = $_GET['photoname']; echo $name ?> </font></td>
   </tr>
</table>
<table border="0">
   <tr>
      <td><font face="Verdana" size="2">Quantity: </font>
      <input type="text" name="T1" size="2"> </td>
   </tr>
</table>
<br>
<table border="0" cellspacing="0" cellpadding="0" height="240" width="596">
<tr>
<td height="20"><font face="Verdana" size="2">&nbsp;First Name: </font>
<font face="Verdana"><font size="1"><input type="text" name="fname" size="17">
</font>
<font color="#FF0000" size="1">*</font></font></td>
</tr>
<tr>
<td height="20"><font face="Verdana" size="2">&nbsp;Last Name: </font>
<font face="Verdana"><font size="1"><input type="text" name="lname" size="29">
</font>
<font color="#FF0000" size="1">*</font></font></td>
</tr>
<tr>
<td height="20"><font face="Verdana"><font size="2">&nbsp;Street Address:
</font><font size="1"><input type="text" name="address" size="31"> </font>
<font size="1" color="#FF0000">*</font><font size="1"> (Please Include Apt #,
Suite #, Floor Etc.)</font></font></td>
</tr>
<tr>
<td height="20"><font face="Verdana"><font size="2">&nbsp;City: </font>
<font size="1">
<input type="text" name="city" size="24">
<font color="#FF0000">*</font></font></font></td>
</tr>
<tr>
<td height="20"><font face="Verdana"><font size="2">&nbsp;State: </font>
<font size="1">
<input type="text" name="State" size="2" value="NJ">
<font color="#FF0000">*</font></font></font></td>
</tr>
<tr>
<td height="20"><font face="Verdana"><font size="2">&nbsp;Zip Code:
</font><font size="1"><input type="text" name="address5" size="9">
<font color="#FF0000">* </font>(Zip+4 Ok)</font></font></td>
</tr>
</table>
<!-- CONTENT ENDS -->
<p align="left"><font color="#FF0000" size="1" face="Verdana">*</font><font face="Verdana" size="2">
</font><font size="1" face="Verdana">Denotes Required Field</font></p>
<a href="print.php">Print Order</a>
  1. <!-- CONTENT STARTS -->
  2. <p align="center"><font face="Verdana">Checkout Page</font></p>
  3. <table border="0">
  4.    <tr>
  5.       <td><font face="Verdana" size="2">&nbsp;Item Name:&nbsp; <?php $name = $_GET['photoname']; echo $name ?> </font></td>
  6.    </tr>
  7. </table>
  8. <table border="0">
  9.    <tr>
  10.       <td><font face="Verdana" size="2">Quantity: </font>
  11.       <input type="text" name="T1" size="2"> </td>
  12.    </tr>
  13. </table>
  14. <br>
  15. <table border="0" cellspacing="0" cellpadding="0" height="240" width="596">
  16. <tr>
  17. <td height="20"><font face="Verdana" size="2">&nbsp;First Name: </font>
  18. <font face="Verdana"><font size="1"><input type="text" name="fname" size="17">
  19. </font>
  20. <font color="#FF0000" size="1">*</font></font></td>
  21. </tr>
  22. <tr>
  23. <td height="20"><font face="Verdana" size="2">&nbsp;Last Name: </font>
  24. <font face="Verdana"><font size="1"><input type="text" name="lname" size="29">
  25. </font>
  26. <font color="#FF0000" size="1">*</font></font></td>
  27. </tr>
  28. <tr>
  29. <td height="20"><font face="Verdana"><font size="2">&nbsp;Street Address:
  30. </font><font size="1"><input type="text" name="address" size="31"> </font>
  31. <font size="1" color="#FF0000">*</font><font size="1"> (Please Include Apt #,
  32. Suite #, Floor Etc.)</font></font></td>
  33. </tr>
  34. <tr>
  35. <td height="20"><font face="Verdana"><font size="2">&nbsp;City: </font>
  36. <font size="1">
  37. <input type="text" name="city" size="24">
  38. <font color="#FF0000">*</font></font></font></td>
  39. </tr>
  40. <tr>
  41. <td height="20"><font face="Verdana"><font size="2">&nbsp;State: </font>
  42. <font size="1">
  43. <input type="text" name="State" size="2" value="NJ">
  44. <font color="#FF0000">*</font></font></font></td>
  45. </tr>
  46. <tr>
  47. <td height="20"><font face="Verdana"><font size="2">&nbsp;Zip Code:
  48. </font><font size="1"><input type="text" name="address5" size="9">
  49. <font color="#FF0000">* </font>(Zip+4 Ok)</font></font></td>
  50. </tr>
  51. </table>
  52. <!-- CONTENT ENDS -->
  53. <p align="left"><font color="#FF0000" size="1" face="Verdana">*</font><font face="Verdana" size="2">
  54. </font><font size="1" face="Verdana">Denotes Required Field</font></p>
  55. <a href="print.php">Print Order</a>


Ok..Now for the 'tough' part it's making me :mad: Been try so hard to get this, need help bad here.

I want to add a simple checkout.php page that can do the following:

1. Save sessions (very simple shopping cart) so more than one item can be added to the checkout.php page
2. Make Printer Friendly (so the page can be printed on paper without problems)

Here's a page where php session help with refresh your memory if need be.

Code: [ Select ]
http://www.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart


I Thank all who help with this project!
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 23rd, 2007, 9:17 am

  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post June 24th, 2007, 10:40 am

Im going to guess that your items are stored in a database?

If they are then you should have some sort of unquie key for every item. What I would do is when someone wants to put something into there cart, you send that unquie id int he URL. On your shopping chart page take that ID and add it to a session array. Then read that array and display the information for that item in the shopping cart.

The only reason I could see you needing to send the title and description of the item in the URL is if you dont have a database to store that information.

A print friendly page of sorts is rather easy, just make it no wider than a standard sheet of paper.
#define NULL (::rand() % 2)
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Jan 06, 2006
  • Posts: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Post June 24th, 2007, 12:24 pm

Did you download Photo-Graffix? It's not a database. I tried creating a database but only because I couldn't seem to get variables working otherwise. All I am asking for is a way to create a simple checkout page, could someone just put up a bit of code for me? The application is very small filesize.

Thanks.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post June 24th, 2007, 1:45 pm

Well if all you want to do is store information that is transfered over the URL you can use this script.

If your trying to make your own system to do money transactions good luck.

PHP Code: [ Select ]
 
<?php
 
 
 
/**
 
 * @author Travis Person
 
 * @copyright 2007
 
 *
 
 * Developed with PHP Designer 2007
 
 *    <!-- m --><span class="postlink">http://mpsoftware.de</span><!-- m -->
 
 *
 
 */
 
 
 
// Start a session
 
   session_start();
 
 
 
// Grab information from URL
 
   $name = $_GET['photoname'];
 
   $desc = $_GET['description'];
 
 
 
// If this is the first time viewing page make the cart session var an array
 
   if (!$_SESSION['cart'])
 
   {
 
         $_SESSION['cart'] = array();
 
   }
 
 
 
// Transfer array
 
   $arrayCART = $_SESSION['cart'];
 
 
 
// Add tiems to the item array
 
   $arrayITEM['NAME'] = $name;
 
   $arrayITEM['DESC'] = $desc;
 
 
 
// Put informtion into the cart
 
   array_push($arrayCART, $arrayITEM);
 
 
 
 
 
// Store the cart back in the session
 
   $_SESSION['cart'] = $arrayCART;
 
 
 
   echo '<table border=\'0\'>'."\n";
 
 
 
   foreach ($arrayCART as $id => $name)
 
   {
 
         foreach ($arrayCART[$id] as $key => $info)
 
         {
 
               echo "\t" . '<tr>'."\n";
 
               echo "\t\t" . '<td>'. $key . ':' . $info . '</td>'."\n";
 
               echo "\t" . '</tr>'."\n";
 
 
 
         }
 
         echo "\t" . '<tr>'."\n";
 
         echo "\t\t" . '<td>&nbsp;</td>'."\n";
 
         echo "\t" . '</tr>'."\n";
 
   }
 
 
 
   echo '</table>'."\n";
 
?>
 
 
  1.  
  2. <?php
  3.  
  4.  
  5.  
  6. /**
  7.  
  8.  * @author Travis Person
  9.  
  10.  * @copyright 2007
  11.  
  12.  *
  13.  
  14.  * Developed with PHP Designer 2007
  15.  
  16.  *    <!-- m --><span class="postlink">http://mpsoftware.de</span><!-- m -->
  17.  
  18.  *
  19.  
  20.  */
  21.  
  22.  
  23.  
  24. // Start a session
  25.  
  26.    session_start();
  27.  
  28.  
  29.  
  30. // Grab information from URL
  31.  
  32.    $name = $_GET['photoname'];
  33.  
  34.    $desc = $_GET['description'];
  35.  
  36.  
  37.  
  38. // If this is the first time viewing page make the cart session var an array
  39.  
  40.    if (!$_SESSION['cart'])
  41.  
  42.    {
  43.  
  44.          $_SESSION['cart'] = array();
  45.  
  46.    }
  47.  
  48.  
  49.  
  50. // Transfer array
  51.  
  52.    $arrayCART = $_SESSION['cart'];
  53.  
  54.  
  55.  
  56. // Add tiems to the item array
  57.  
  58.    $arrayITEM['NAME'] = $name;
  59.  
  60.    $arrayITEM['DESC'] = $desc;
  61.  
  62.  
  63.  
  64. // Put informtion into the cart
  65.  
  66.    array_push($arrayCART, $arrayITEM);
  67.  
  68.  
  69.  
  70.  
  71.  
  72. // Store the cart back in the session
  73.  
  74.    $_SESSION['cart'] = $arrayCART;
  75.  
  76.  
  77.  
  78.    echo '<table border=\'0\'>'."\n";
  79.  
  80.  
  81.  
  82.    foreach ($arrayCART as $id => $name)
  83.  
  84.    {
  85.  
  86.          foreach ($arrayCART[$id] as $key => $info)
  87.  
  88.          {
  89.  
  90.                echo "\t" . '<tr>'."\n";
  91.  
  92.                echo "\t\t" . '<td>'. $key . ':' . $info . '</td>'."\n";
  93.  
  94.                echo "\t" . '</tr>'."\n";
  95.  
  96.  
  97.  
  98.          }
  99.  
  100.          echo "\t" . '<tr>'."\n";
  101.  
  102.          echo "\t\t" . '<td>&nbsp;</td>'."\n";
  103.  
  104.          echo "\t" . '</tr>'."\n";
  105.  
  106.    }
  107.  
  108.  
  109.  
  110.    echo '</table>'."\n";
  111.  
  112. ?>
  113.  
  114.  
#define NULL (::rand() % 2)
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Jan 06, 2006
  • Posts: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Post June 25th, 2007, 7:21 am

I am going to give it a shot SpooF. I will post back on how it works

Thanks alot.
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Jan 06, 2006
  • Posts: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Post June 25th, 2007, 8:16 am

Hi SpooF,

It did work, but I had to modify it abit...Basically what I needed was to have the name and description to be included in one url string, so I had to combine it to this:

Code: [ Select ]
http://mydomain.com/gallery/checkout.php?photoname=12345&description=test


It works fine, but could you help me do one more thing? I need to know how the submit button link would be on an actual checkout page..Assuming you use an html form with the following fields:

Name:
Address:
City:
State:
Zip:

Then I will modify the form to my needs.
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Jan 06, 2006
  • Posts: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Post June 25th, 2007, 9:15 am

Here's exactly what I am trying to achieve with the exception of having the Name and Description variables as well as a simple quantity text box so they can enter how many to order:

Code: [ Select ]
http://www.stocksignalpro.com/SSP279order_mail.htm
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Jan 06, 2006
  • Posts: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Post June 25th, 2007, 11:50 am

Could you do something like that?
Code: [ Select ]
http://www.stocksignalpro.com/SSP279order_mail.htm
With the addition of a quantity text box where they could enter the quantity. Or are you too busy atm? I appreciate you efforts up to this point, however.

Thanks alot in advance!

-Brian
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post June 25th, 2007, 2:55 pm

So basicly you want it so when a customer is done, they can fill in the rest of the fields, such as in the link you gave, and then submit it to a page to proccess?

If so then thats rather easy. All you do is create a form and have it submit to a php page. Onces its there you can use the $_POST['fieldVarName'] to retrieve the information and do what you want with it.
#define NULL (::rand() % 2)
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Jan 06, 2006
  • Posts: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Post June 25th, 2007, 3:05 pm

Could you set me up with a simple page with the links already in tact? I know I am asking alot, but I have really put everything I had into this, and it's like I am going in circles with it...Your help is greatly appreciated.

Thanks again!
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post June 25th, 2007, 3:26 pm

Something like this:


PHP Code: [ Select ]
<?php
 
 
 
/**
 
 *  @author  Travis  Person
 
 *  @copyright  2007
 
 *  
 
 *  Developed  with  PHP  Designer  2007  
 
 *                <!-- m --><span class="postlink">http://mpsoftware.de</span><!-- m -->
 
 *
 
 */
 
 
 
   //  Start  a  session
 
   session_start();
 
   
 
   //  Grab  information  from  URL
 
   $name = $_GET['photoname'];
 
   $desc = $_GET['description'];
 
   
 
   //  If  this  is  the  first  time  viewing  page  make  the  cart  session  var  an  array
 
   if (!$_SESSION['cart'])
 
   {
 
     $_SESSION['cart'] = array();
 
   }
 
   
 
   //  Transfer  array
 
   $arrayCART = $_SESSION['cart'];
 
   
 
   //  Add  tiems  to  the  item  array
 
   $arrayITEM['NAME'] = $name;
 
   $arrayITEM['DESC'] = $desc;
 
   
 
   //  Put  informtion  into  the  cart
 
   array_push($arrayCART, $arrayITEM);
 
   
 
   
 
   //  Store  the  cart  back  in  the  session
 
   $_SESSION['cart'] = $arrayCART;
 
   
 
   echo '<table  border=\'0\'>' . "\n";
 
   
 
   foreach ($arrayCART as $id => $name)
 
   {
 
     foreach ($arrayCART[$id] as $key => $info)
 
     {
 
       echo "\t" . '<tr>' . "\n";
 
       echo "\t\t" . '<td>' . $key . ':' . $info . '</td>' . "\n";
 
       echo "\t" . '</tr>' . "\n";
 
   
 
     }
 
     echo "\t" . '<tr>' . "\n";
 
     echo "\t\t" . '<td>&nbsp;</td>' . "\n";
 
     echo "\t" . '</tr>' . "\n";
 
   }
 
   
 
   echo '</table>' . "\n";
 
   
 
   echo '<br>';
 
   echo '<br>';
 
   echo '<br>';
 
   
 
   
 
   if ($_GET['submit'])
 
   {
 
   
 
     //Process submition
 
   
 
     $f_name = $_GET['f_name'];
 
     $f_addr = $_GET['f_addr'];
 
     $f_city = $_GET['f_city'];
 
     $f_state = $_GET['f_state'];
 
     $f_zipcode = $_GET['f_zipcode'];
 
     $f_phone = $_GET['f_phone'];
 
     $f_email = $_GET['f_email'];
 
   
 
   
 
     $message .= 'Name:' . $f_name . "\n";
 
     $message .= 'Address:' . $f_addr . "\n";
 
     $message .= 'City:' . $f_city . "\n";
 
     $message .= 'State:' . $f_state . "\n";
 
     $message .= 'Zip:' . $f_zipcode . "\n";
 
     $message .= 'Phone:' . $f_phone . "\n";
 
     $message .= 'Email:' . $f_email . "\n";
 
   
 
     $result = @mail('youremail@domain.com', 'New Order', $message);
 
   
 
     if ($result)
 
     {
 
       echo 'Order Sent';
 
     }
 
     else
 
     {
 
       echo 'Error occured, please try again';
 
     }
 
   
 
   }
 
   else
 
   {
 
   
 
     echo '          <h2>Continie Checkout</h2>';
 
     echo '          <table border="0" cellpadding="3" cellspacing="0" width="500" bgcolor="#EEEFEE" style="border: D6DFE8 solid 1px">';
 
     echo '            <tr valign="top">';
 
     echo '              <td></td><td><div class="noprint"><p align="left"><font face="Verdana" size="2" color="FF0000"><b>Info Text</b></font></div></td>';
 
     echo '            </tr>';
 
     echo '       <form name="myform">';
 
     echo '            <tr>';
 
     echo '              <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Name:</font></td>';
 
     echo '              <td width="251" height="31"><font face="Verdana" size="2">';
 
     echo '                <input maxlength=40 size=40 name="f_name" tabindex="1" value="">';
 
     echo '              </font></td>';
 
     echo '            </tr>';
 
     echo '            <tr>';
 
     echo '              <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Address:</font></td>';
 
     echo '              <td width="251" height="31"><font face="Verdana" size="2">';
 
     echo '         <input maxlength=40 size=40 name="f_addr" tabindex="2"> ';
 
     echo '         </font></td>';
 
     echo '            </tr>';
 
     echo '            <tr>';
 
     echo '              <td width="100" height="31"><font face="Verdana" size="2"> &nbsp;&nbsp;&nbsp;City:</font></td>';
 
     echo '              <td width="251" height="31"><font face="Verdana" size="2">';
 
     echo '                <input maxlength=20 size=20 name="f_city" tabindex="3"></font></td>';
 
     echo '            </tr>';
 
     echo '            <tr>';
 
     echo '              <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; State:</font></td>';
 
     echo '              <td width="251" height="31"><font face="Verdana" size="2">';
 
     echo '         <select name="f_state" tabindex="4">';
 
     echo '            <option value="0">State...</option>';
 
     echo '            <option value="Na">Other / Not USA</option>';
 
     echo '            <option value="AL" >Alabama</option>';
 
     echo '            <option value="AK" >Alaska</option>';
 
     echo '            <option value="AZ" >Arizona</option>';
 
     echo '            <option value="AR" >Arkansas</option>';
 
     echo '            <option value="CA" >California</option>';
 
     echo '            <option value="CO" >Colorado</option>';
 
     echo '            <option value="CT" >Connecticut</option>';
 
     echo '            <option value="DE" >Delaware</option>';
 
     echo '            <option value="DC" >District of Columbia</option>';
 
     echo '            <option value="FL" >Florida</option>';
 
     echo '            <option value="GA" >Georgia</option>';
 
     echo '            <option value="HI" >Hawaii</option>';
 
     echo '            <option value="ID" >Idaho</option>';
 
     echo '            <option value="IL" >Illinois</option>';
 
     echo '            <option value="IN" >Indiana</option>';
 
     echo '            <option value="IO" >Iowa</option>';
 
     echo '            <option value="KS" >Kansas</option>';
 
     echo '            <option value="KY" >Kentucky</option>';
 
     echo '            <option value="LA" >Louisiana</option>';
 
     echo '            <option value="ME" >Maine</option>';
 
     echo '            <option value="MD" >Maryland</option>';
 
     echo '            <option value="MA" >Massachusetts</option>';
 
     echo '            <option value="MI" >Michigan</option>';
 
     echo '            <option value="MN" >Minnesota</option>';
 
     echo '            <option value="MS" >Mississippi</option>';
 
     echo '            <option value="MO" >Missouri</option>';
 
     echo '            <option value="MT" >Montana</option>';
 
     echo '            <option value="NE" >Nebraska</option>';
 
     echo '            <option value="NV" >Nevada</option>';
 
     echo '            <option value="NH" >New Hampshire</option>';
 
     echo '            <option value="NJ" >New Jersey</option>';
 
     echo '            <option value="NM" >New Mexico</option>';
 
     echo '            <option value="NY" >New York</option>';
 
     echo '            <option value="NC" >North Carolina</option>';
 
     echo '            <option value="ND" >North Dakota</option>';
 
     echo '            <option value="OH" >Ohio</option>';
 
     echo '            <option value="OK" >Oklahoma</option>';
 
     echo '            <option value="OR" >Oregon</option>';
 
     echo '            <option value="PA" >Pennsylvania</option>';
 
     echo '            <option value="RI" >Rhode Island</option>';
 
     echo '            <option value="SC" >South Carolina</option>';
 
     echo '            <option value="SD" >South Dakota</option>';
 
     echo '            <option value="TN" >Tennessee</option>';
 
     echo '            <option value="TX" >Texas</option>';
 
     echo '            <option value="UT" >Utah</option>';
 
     echo '            <option value="VT" >Vermont</option>';
 
     echo '            <option value="VA" >Virginia</option>';
 
     echo '            <option value="WA" >Washington</option>';
 
     echo '            <option value="WV" >West Virginia</option>';
 
     echo '            <option value="WI" >Wisconsin</option>';
 
     echo '            <option value="WY" >Wyoming</option>';
 
     echo '          </select></font></td>';
 
     echo '            </tr>';
 
     echo '            <tr>';
 
     echo '              <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Zip:</font></td>';
 
     echo '              <td width="251" height="31"><font face="Verdana" size="2">';
 
     echo '                <input maxlength=10 size=10 name="f_zipcode" tabindex="5">';
 
     echo '              </font></td>';
 
     echo '            </tr>';
 
     echo '        <tr>';
 
     echo '                <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Phone#:</font></td>';
 
     echo '              <td width="243" height="31"><font face="Verdana" size="2">';
 
     echo '                <input maxlength=16 size=16 name="f_phone" tabindex="7">';
 
     echo '              </font></td>';
 
     echo '            </tr>';
 
     echo '            <tr>';
 
     echo '              <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; E-mail:</font></td>';
 
     echo '              <td width="253" height="31"><font face="Verdana" size="2">';
 
     echo '                <input maxlength=40 size=40 name="f_email" tabindex="8" value="">';
 
     echo '              </font></td>';
 
     echo '            </tr>';
 
     echo '            <tr>';
 
     echo '              <td colspan="2" width="520"><div class="noprint"><p align="center"><font face="Verdana" size="2">';
 
     echo '                  <input type=button value="Click Here to Submit" name=submit tabindex="9">';
 
     echo '              </font></p></div></td>';
 
     echo '            </tr>';
 
     echo '       </form>';
 
     echo '          </table>';
 
   }
 
 
 
?>
  1. <?php
  2.  
  3.  
  4.  
  5. /**
  6.  
  7.  *  @author  Travis  Person
  8.  
  9.  *  @copyright  2007
  10.  
  11.  *  
  12.  
  13.  *  Developed  with  PHP  Designer  2007  
  14.  
  15.  *                <!-- m --><span class="postlink">http://mpsoftware.de</span><!-- m -->
  16.  
  17.  *
  18.  
  19.  */
  20.  
  21.  
  22.  
  23.    //  Start  a  session
  24.  
  25.    session_start();
  26.  
  27.    
  28.  
  29.    //  Grab  information  from  URL
  30.  
  31.    $name = $_GET['photoname'];
  32.  
  33.    $desc = $_GET['description'];
  34.  
  35.    
  36.  
  37.    //  If  this  is  the  first  time  viewing  page  make  the  cart  session  var  an  array
  38.  
  39.    if (!$_SESSION['cart'])
  40.  
  41.    {
  42.  
  43.      $_SESSION['cart'] = array();
  44.  
  45.    }
  46.  
  47.    
  48.  
  49.    //  Transfer  array
  50.  
  51.    $arrayCART = $_SESSION['cart'];
  52.  
  53.    
  54.  
  55.    //  Add  tiems  to  the  item  array
  56.  
  57.    $arrayITEM['NAME'] = $name;
  58.  
  59.    $arrayITEM['DESC'] = $desc;
  60.  
  61.    
  62.  
  63.    //  Put  informtion  into  the  cart
  64.  
  65.    array_push($arrayCART, $arrayITEM);
  66.  
  67.    
  68.  
  69.    
  70.  
  71.    //  Store  the  cart  back  in  the  session
  72.  
  73.    $_SESSION['cart'] = $arrayCART;
  74.  
  75.    
  76.  
  77.    echo '<table  border=\'0\'>' . "\n";
  78.  
  79.    
  80.  
  81.    foreach ($arrayCART as $id => $name)
  82.  
  83.    {
  84.  
  85.      foreach ($arrayCART[$id] as $key => $info)
  86.  
  87.      {
  88.  
  89.        echo "\t" . '<tr>' . "\n";
  90.  
  91.        echo "\t\t" . '<td>' . $key . ':' . $info . '</td>' . "\n";
  92.  
  93.        echo "\t" . '</tr>' . "\n";
  94.  
  95.    
  96.  
  97.      }
  98.  
  99.      echo "\t" . '<tr>' . "\n";
  100.  
  101.      echo "\t\t" . '<td>&nbsp;</td>' . "\n";
  102.  
  103.      echo "\t" . '</tr>' . "\n";
  104.  
  105.    }
  106.  
  107.    
  108.  
  109.    echo '</table>' . "\n";
  110.  
  111.    
  112.  
  113.    echo '<br>';
  114.  
  115.    echo '<br>';
  116.  
  117.    echo '<br>';
  118.  
  119.    
  120.  
  121.    
  122.  
  123.    if ($_GET['submit'])
  124.  
  125.    {
  126.  
  127.    
  128.  
  129.      //Process submition
  130.  
  131.    
  132.  
  133.      $f_name = $_GET['f_name'];
  134.  
  135.      $f_addr = $_GET['f_addr'];
  136.  
  137.      $f_city = $_GET['f_city'];
  138.  
  139.      $f_state = $_GET['f_state'];
  140.  
  141.      $f_zipcode = $_GET['f_zipcode'];
  142.  
  143.      $f_phone = $_GET['f_phone'];
  144.  
  145.      $f_email = $_GET['f_email'];
  146.  
  147.    
  148.  
  149.    
  150.  
  151.      $message .= 'Name:' . $f_name . "\n";
  152.  
  153.      $message .= 'Address:' . $f_addr . "\n";
  154.  
  155.      $message .= 'City:' . $f_city . "\n";
  156.  
  157.      $message .= 'State:' . $f_state . "\n";
  158.  
  159.      $message .= 'Zip:' . $f_zipcode . "\n";
  160.  
  161.      $message .= 'Phone:' . $f_phone . "\n";
  162.  
  163.      $message .= 'Email:' . $f_email . "\n";
  164.  
  165.    
  166.  
  167.      $result = @mail('youremail@domain.com', 'New Order', $message);
  168.  
  169.    
  170.  
  171.      if ($result)
  172.  
  173.      {
  174.  
  175.        echo 'Order Sent';
  176.  
  177.      }
  178.  
  179.      else
  180.  
  181.      {
  182.  
  183.        echo 'Error occured, please try again';
  184.  
  185.      }
  186.  
  187.    
  188.  
  189.    }
  190.  
  191.    else
  192.  
  193.    {
  194.  
  195.    
  196.  
  197.      echo '          <h2>Continie Checkout</h2>';
  198.  
  199.      echo '          <table border="0" cellpadding="3" cellspacing="0" width="500" bgcolor="#EEEFEE" style="border: D6DFE8 solid 1px">';
  200.  
  201.      echo '            <tr valign="top">';
  202.  
  203.      echo '              <td></td><td><div class="noprint"><p align="left"><font face="Verdana" size="2" color="FF0000"><b>Info Text</b></font></div></td>';
  204.  
  205.      echo '            </tr>';
  206.  
  207.      echo '       <form name="myform">';
  208.  
  209.      echo '            <tr>';
  210.  
  211.      echo '              <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Name:</font></td>';
  212.  
  213.      echo '              <td width="251" height="31"><font face="Verdana" size="2">';
  214.  
  215.      echo '                <input maxlength=40 size=40 name="f_name" tabindex="1" value="">';
  216.  
  217.      echo '              </font></td>';
  218.  
  219.      echo '            </tr>';
  220.  
  221.      echo '            <tr>';
  222.  
  223.      echo '              <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Address:</font></td>';
  224.  
  225.      echo '              <td width="251" height="31"><font face="Verdana" size="2">';
  226.  
  227.      echo '         <input maxlength=40 size=40 name="f_addr" tabindex="2"> ';
  228.  
  229.      echo '         </font></td>';
  230.  
  231.      echo '            </tr>';
  232.  
  233.      echo '            <tr>';
  234.  
  235.      echo '              <td width="100" height="31"><font face="Verdana" size="2"> &nbsp;&nbsp;&nbsp;City:</font></td>';
  236.  
  237.      echo '              <td width="251" height="31"><font face="Verdana" size="2">';
  238.  
  239.      echo '                <input maxlength=20 size=20 name="f_city" tabindex="3"></font></td>';
  240.  
  241.      echo '            </tr>';
  242.  
  243.      echo '            <tr>';
  244.  
  245.      echo '              <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; State:</font></td>';
  246.  
  247.      echo '              <td width="251" height="31"><font face="Verdana" size="2">';
  248.  
  249.      echo '         <select name="f_state" tabindex="4">';
  250.  
  251.      echo '            <option value="0">State...</option>';
  252.  
  253.      echo '            <option value="Na">Other / Not USA</option>';
  254.  
  255.      echo '            <option value="AL" >Alabama</option>';
  256.  
  257.      echo '            <option value="AK" >Alaska</option>';
  258.  
  259.      echo '            <option value="AZ" >Arizona</option>';
  260.  
  261.      echo '            <option value="AR" >Arkansas</option>';
  262.  
  263.      echo '            <option value="CA" >California</option>';
  264.  
  265.      echo '            <option value="CO" >Colorado</option>';
  266.  
  267.      echo '            <option value="CT" >Connecticut</option>';
  268.  
  269.      echo '            <option value="DE" >Delaware</option>';
  270.  
  271.      echo '            <option value="DC" >District of Columbia</option>';
  272.  
  273.      echo '            <option value="FL" >Florida</option>';
  274.  
  275.      echo '            <option value="GA" >Georgia</option>';
  276.  
  277.      echo '            <option value="HI" >Hawaii</option>';
  278.  
  279.      echo '            <option value="ID" >Idaho</option>';
  280.  
  281.      echo '            <option value="IL" >Illinois</option>';
  282.  
  283.      echo '            <option value="IN" >Indiana</option>';
  284.  
  285.      echo '            <option value="IO" >Iowa</option>';
  286.  
  287.      echo '            <option value="KS" >Kansas</option>';
  288.  
  289.      echo '            <option value="KY" >Kentucky</option>';
  290.  
  291.      echo '            <option value="LA" >Louisiana</option>';
  292.  
  293.      echo '            <option value="ME" >Maine</option>';
  294.  
  295.      echo '            <option value="MD" >Maryland</option>';
  296.  
  297.      echo '            <option value="MA" >Massachusetts</option>';
  298.  
  299.      echo '            <option value="MI" >Michigan</option>';
  300.  
  301.      echo '            <option value="MN" >Minnesota</option>';
  302.  
  303.      echo '            <option value="MS" >Mississippi</option>';
  304.  
  305.      echo '            <option value="MO" >Missouri</option>';
  306.  
  307.      echo '            <option value="MT" >Montana</option>';
  308.  
  309.      echo '            <option value="NE" >Nebraska</option>';
  310.  
  311.      echo '            <option value="NV" >Nevada</option>';
  312.  
  313.      echo '            <option value="NH" >New Hampshire</option>';
  314.  
  315.      echo '            <option value="NJ" >New Jersey</option>';
  316.  
  317.      echo '            <option value="NM" >New Mexico</option>';
  318.  
  319.      echo '            <option value="NY" >New York</option>';
  320.  
  321.      echo '            <option value="NC" >North Carolina</option>';
  322.  
  323.      echo '            <option value="ND" >North Dakota</option>';
  324.  
  325.      echo '            <option value="OH" >Ohio</option>';
  326.  
  327.      echo '            <option value="OK" >Oklahoma</option>';
  328.  
  329.      echo '            <option value="OR" >Oregon</option>';
  330.  
  331.      echo '            <option value="PA" >Pennsylvania</option>';
  332.  
  333.      echo '            <option value="RI" >Rhode Island</option>';
  334.  
  335.      echo '            <option value="SC" >South Carolina</option>';
  336.  
  337.      echo '            <option value="SD" >South Dakota</option>';
  338.  
  339.      echo '            <option value="TN" >Tennessee</option>';
  340.  
  341.      echo '            <option value="TX" >Texas</option>';
  342.  
  343.      echo '            <option value="UT" >Utah</option>';
  344.  
  345.      echo '            <option value="VT" >Vermont</option>';
  346.  
  347.      echo '            <option value="VA" >Virginia</option>';
  348.  
  349.      echo '            <option value="WA" >Washington</option>';
  350.  
  351.      echo '            <option value="WV" >West Virginia</option>';
  352.  
  353.      echo '            <option value="WI" >Wisconsin</option>';
  354.  
  355.      echo '            <option value="WY" >Wyoming</option>';
  356.  
  357.      echo '          </select></font></td>';
  358.  
  359.      echo '            </tr>';
  360.  
  361.      echo '            <tr>';
  362.  
  363.      echo '              <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Zip:</font></td>';
  364.  
  365.      echo '              <td width="251" height="31"><font face="Verdana" size="2">';
  366.  
  367.      echo '                <input maxlength=10 size=10 name="f_zipcode" tabindex="5">';
  368.  
  369.      echo '              </font></td>';
  370.  
  371.      echo '            </tr>';
  372.  
  373.      echo '        <tr>';
  374.  
  375.      echo '                <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Phone#:</font></td>';
  376.  
  377.      echo '              <td width="243" height="31"><font face="Verdana" size="2">';
  378.  
  379.      echo '                <input maxlength=16 size=16 name="f_phone" tabindex="7">';
  380.  
  381.      echo '              </font></td>';
  382.  
  383.      echo '            </tr>';
  384.  
  385.      echo '            <tr>';
  386.  
  387.      echo '              <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; E-mail:</font></td>';
  388.  
  389.      echo '              <td width="253" height="31"><font face="Verdana" size="2">';
  390.  
  391.      echo '                <input maxlength=40 size=40 name="f_email" tabindex="8" value="">';
  392.  
  393.      echo '              </font></td>';
  394.  
  395.      echo '            </tr>';
  396.  
  397.      echo '            <tr>';
  398.  
  399.      echo '              <td colspan="2" width="520"><div class="noprint"><p align="center"><font face="Verdana" size="2">';
  400.  
  401.      echo '                  <input type=button value="Click Here to Submit" name=submit tabindex="9">';
  402.  
  403.      echo '              </font></p></div></td>';
  404.  
  405.      echo '            </tr>';
  406.  
  407.      echo '       </form>';
  408.  
  409.      echo '          </table>';
  410.  
  411.    }
  412.  
  413.  
  414.  
  415. ?>
#define NULL (::rand() % 2)
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Jan 06, 2006
  • Posts: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Post June 25th, 2007, 3:41 pm

That page works, but not the submit button, and I had a look at your code, and it seems a bit overwhelming for me. If the page that I am putting the above code on is called checkout.php, would I need to create another final checkout page for it to work? Basically all I want now is the Click here to submit, to be linked to a printer friendly page with the forms content, when the customer clicks that button it would print out and then they can either fax or mail that order to me with the product name/description and their address information.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post June 25th, 2007, 5:14 pm

Here it is:

Code: [ Select ]
<?php

/**
* @author Travis Person
* @copyright 2007

* Developed with PHP Designer 2007 
*        http://mpsoftware.de
*
*/

    // Start a session.
    session_start();
    // Grab information from URL.
    $name = $_GET['photoname'];
    $desc = $_GET['description'];
    
    // If this is the first time viewing page make the cart session var an array.
    if (!$_SESSION['cart'])
    {
     $_SESSION['cart'] = array();
    }
    
    // Transfer array.
    $arrayCART = $_SESSION['cart'];
    
    // Add tiems to the item array.
    $arrayITEM['NAME'] = $name;
    $arrayITEM['DESC'] = $desc;
    
    // If they have submited a form they arnt going to need to add another item so we wont.
    if (!$_POST['submit'])
    {
     // Put informtion into the cart.
     array_push($arrayCART, $arrayITEM);
    
    
     // Store the cart back in the session.
     $_SESSION['cart'] = $arrayCART;
    }
    
    // DISPLAYS BEFORE ORDER INFORMATION //
    echo '<table border=\'0\'>' . "\n";
    // // // // // // // // // // // // //
    
    foreach ($arrayCART as $id => $name)
    {
     // DISPLAYS INBETWEEN ITEMS BEFORE //
    
     // // // // // // // // // // // // //
     foreach ($arrayCART[$id] as $key => $info)
     {
      //  DISPLAYS PER EACH ITEM FIELD  //
      echo "\t" . '<tr>' . "\n";
      echo "\t\t" . '<td>' . $key . ':' . $info . '</td>' . "\n";
      echo "\t" . '</tr>' . "\n";
      // // // // // // // // // // // // //
    
     }
     // DISPLAYS INBETWEEN ITEMS AFTER //
     echo "\t" . '<tr>' . "\n";
     echo "\t\t" . '<td>&nbsp;</td>' . "\n";
     echo "\t" . '</tr>' . "\n";
     // // // // // // // // // // // // //
    }
    // DISPLAYS AFTER ORDER INFORMATION //
    echo '</table>' . "\n";
    // // // // // // // // // // // // //
    
    echo '<br>' . "\n";
    echo '<br>' . "\n";
    echo '<br>' . "\n";
    
    // If the form is submited we want to display the information they entered.
    if ($_POST['submit'])
    {
    
     // Process submition.
     $f_name = $_POST['f_name'];
     $f_addr = $_POST['f_addr'];
     $f_city = $_POST['f_city'];
     $f_state = $_POST['f_state'];
     $f_zipcode = $_POST['f_zipcode'];
     $f_phone = $_POST['f_phone'];
     $f_email = $_POST['f_email'];
    
     // Put submited information into a varible to display (You dont really need to store if but its standard for me).
     $message .= 'Name:' . $f_name . "<br>\n";
     $message .= 'Address:' . $f_addr . "<br>\n";
     $message .= 'City:' . $f_city . "<br>\n";
     $message .= 'State:' . $f_state . "<br>\n";
     $message .= 'Zip:' . $f_zipcode . "<br>\n";
     $message .= 'Phone:' . $f_phone . "<br>\n";
     $message .= 'Email:' . $f_email . "<br>\n";
    
     // Display the message.
     echo $message;
    
    }
    else
    {
     // If they have not submited there order then we want to give them the option too.
    
    
     // THIS IS JUST A BUNCH OF HTML CODE DISPLAYED LINE BY LINE //
     // THIS IS JUST A BUNCH OF HTML CODE DISPLAYED LINE BY LINE //
     // THIS IS JUST A BUNCH OF HTML CODE DISPLAYED LINE BY LINE //
    
     // There is nothing really crazy about this code below, just standard html.
     echo '     <h2>Continie Checkout</h2>' . "\n";
     echo '     <table border="0" cellpadding="3" cellspacing="0" width="500" bgcolor="#EEEFEE" style="border: D6DFE8 solid 1px">' . "\n";
     echo '      <tr valign="top">' . "\n";
     echo '       <td></td><td><div class="noprint"><p align="left"><font face="Verdana" size="2" color="FF0000"><b>Info Text</b></font></div></td>' . "\n";
     echo '      </tr>' . "\n";
     echo '            <form method="post" name="myform">' . "\n";
     echo '      <tr>' . "\n";
     echo '       <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Name:</font></td>' . "\n";
     echo '       <td width="251" height="31"><font face="Verdana" size="2">' . "\n";
     echo '        <input maxlength=40 size=40 name="f_name" tabindex="1" value="">' . "\n";
     echo '       </font></td>' . "\n";
     echo '      </tr>' . "\n";
     echo '      <tr>' . "\n";
     echo '       <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Address:</font></td>' . "\n";
     echo '       <td width="251" height="31"><font face="Verdana" size="2">' . "\n";
     echo '             <input maxlength=40 size=40 name="f_addr" tabindex="2"> ' . "\n";
     echo '             </font></td>' . "\n";
     echo '      </tr>' . "\n";
     echo '      <tr>' . "\n";
     echo '       <td width="100" height="31"><font face="Verdana" size="2"> &nbsp;&nbsp;&nbsp;City:</font></td>' . "\n";
     echo '       <td width="251" height="31"><font face="Verdana" size="2">' . "\n";
     echo '        <input maxlength=20 size=20 name="f_city" tabindex="3"></font></td>' . "\n";
     echo '      </tr>' . "\n";
     echo '      <tr>' . "\n";
     echo '       <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; State:</font></td>' . "\n";
     echo '       <td width="251" height="31"><font face="Verdana" size="2">' . "\n";
     echo '             <select name="f_state" tabindex="4">' . "\n";
     echo '                 <option value="0">State...</option>' . "\n";
     echo '                 <option value="Na">Other / Not USA</option>' . "\n";
     echo '                 <option value="AL" >Alabama</option>' . "\n";
     echo '                 <option value="AK" >Alaska</option>' . "\n";
     echo '                 <option value="AZ" >Arizona</option>' . "\n";
     echo '                 <option value="AR" >Arkansas</option>' . "\n";
     echo '                 <option value="CA" >California</option>' . "\n";
     echo '                 <option value="CO" >Colorado</option>' . "\n";
     echo '                 <option value="CT" >Connecticut</option>' . "\n";
     echo '                 <option value="DE" >Delaware</option>' . "\n";
     echo '                 <option value="DC" >District of Columbia</option>' . "\n";
     echo '                 <option value="FL" >Florida</option>' . "\n";
     echo '                 <option value="GA" >Georgia</option>' . "\n";
     echo '                 <option value="HI" >Hawaii</option>' . "\n";
     echo '                 <option value="ID" >Idaho</option>' . "\n";
     echo '                 <option value="IL" >Illinois</option>' . "\n";
     echo '                 <option value="IN" >Indiana</option>' . "\n";
     echo '                 <option value="IO" >Iowa</option>' . "\n";
     echo '                 <option value="KS" >Kansas</option>' . "\n";
     echo '                 <option value="KY" >Kentucky</option>' . "\n";
     echo '                 <option value="LA" >Louisiana</option>' . "\n";
     echo '                 <option value="ME" >Maine</option>' . "\n";
     echo '                 <option value="MD" >Maryland</option>' . "\n";
     echo '                 <option value="MA" >Massachusetts</option>' . "\n";
     echo '                 <option value="MI" >Michigan</option>' . "\n";
     echo '                 <option value="MN" >Minnesota</option>' . "\n";
     echo '                 <option value="MS" >Mississippi</option>' . "\n";
     echo '                 <option value="MO" >Missouri</option>' . "\n";
     echo '                 <option value="MT" >Montana</option>' . "\n";
     echo '                 <option value="NE" >Nebraska</option>' . "\n";
     echo '                 <option value="NV" >Nevada</option>' . "\n";
     echo '                 <option value="NH" >New Hampshire</option>' . "\n";
     echo '                 <option value="NJ" >New Jersey</option>' . "\n";
     echo '                 <option value="NM" >New Mexico</option>' . "\n";
     echo '                 <option value="NY" >New York</option>' . "\n";
     echo '                 <option value="NC" >North Carolina</option>' . "\n";
     echo '                 <option value="ND" >North Dakota</option>' . "\n";
     echo '                 <option value="OH" >Ohio</option>' . "\n";
     echo '                 <option value="OK" >Oklahoma</option>' . "\n";
     echo '                 <option value="OR" >Oregon</option>' . "\n";
     echo '                 <option value="PA" >Pennsylvania</option>' . "\n";
     echo '                 <option value="RI" >Rhode Island</option>' . "\n";
     echo '                 <option value="SC" >South Carolina</option>' . "\n";
     echo '                 <option value="SD" >South Dakota</option>' . "\n";
     echo '                 <option value="TN" >Tennessee</option>' . "\n";
     echo '                 <option value="TX" >Texas</option>' . "\n";
     echo '                 <option value="UT" >Utah</option>' . "\n";
     echo '                 <option value="VT" >Vermont</option>' . "\n";
     echo '                 <option value="VA" >Virginia</option>' . "\n";
     echo '                 <option value="WA" >Washington</option>' . "\n";
     echo '                 <option value="WV" >West Virginia</option>' . "\n";
     echo '                 <option value="WI" >Wisconsin</option>' . "\n";
     echo '                 <option value="WY" >Wyoming</option>' . "\n";
     echo '                </select></font></td>' . "\n";
     echo '      </tr>' . "\n";
     echo '      <tr>' . "\n";
     echo '       <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Zip:</font></td>' . "\n";
     echo '       <td width="251" height="31"><font face="Verdana" size="2">' . "\n";
     echo '        <input maxlength=10 size=10 name="f_zipcode" tabindex="5">' . "\n";
     echo '       </font></td>' . "\n";
     echo '      </tr>' . "\n";
     echo '             <tr>' . "\n";
     echo '        <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Phone#:</font></td>' . "\n";
     echo '       <td width="243" height="31"><font face="Verdana" size="2">' . "\n";
     echo '        <input maxlength=16 size=16 name="f_phone" tabindex="7">' . "\n";
     echo '       </font></td>' . "\n";
     echo '      </tr>' . "\n";
     echo '      <tr>' . "\n";
     echo '       <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; E-mail:</font></td>' . "\n";
     echo '       <td width="253" height="31"><font face="Verdana" size="2">' . "\n";
     echo '        <input maxlength=40 size=40 name="f_email" tabindex="8" value="">' . "\n";
     echo '       </font></td>' . "\n";
     echo '      </tr>' . "\n";
     echo '      <tr>' . "\n";
     echo '       <td colspan="2" width="520"><div class="noprint"><p align="center"><font face="Verdana" size="2">' . "\n";
     echo '         <input type=submit value="Click Here to Submit" name=submit tabindex="9">' . "\n";
     echo '       </font></p></div></td>' . "\n";
     echo '      </tr>' . "\n";
     echo '            </form>' . "\n";
     echo '     </table>' . "\n";
    }

?>
  1. <?php
  2. /**
  3. * @author Travis Person
  4. * @copyright 2007
  5. * Developed with PHP Designer 2007 
  6. *        http://mpsoftware.de
  7. *
  8. */
  9.     // Start a session.
  10.     session_start();
  11.     // Grab information from URL.
  12.     $name = $_GET['photoname'];
  13.     $desc = $_GET['description'];
  14.     
  15.     // If this is the first time viewing page make the cart session var an array.
  16.     if (!$_SESSION['cart'])
  17.     {
  18.      $_SESSION['cart'] = array();
  19.     }
  20.     
  21.     // Transfer array.
  22.     $arrayCART = $_SESSION['cart'];
  23.     
  24.     // Add tiems to the item array.
  25.     $arrayITEM['NAME'] = $name;
  26.     $arrayITEM['DESC'] = $desc;
  27.     
  28.     // If they have submited a form they arnt going to need to add another item so we wont.
  29.     if (!$_POST['submit'])
  30.     {
  31.      // Put informtion into the cart.
  32.      array_push($arrayCART, $arrayITEM);
  33.     
  34.     
  35.      // Store the cart back in the session.
  36.      $_SESSION['cart'] = $arrayCART;
  37.     }
  38.     
  39.     // DISPLAYS BEFORE ORDER INFORMATION //
  40.     echo '<table border=\'0\'>' . "\n";
  41.     // // // // // // // // // // // // //
  42.     
  43.     foreach ($arrayCART as $id => $name)
  44.     {
  45.      // DISPLAYS INBETWEEN ITEMS BEFORE //
  46.     
  47.      // // // // // // // // // // // // //
  48.      foreach ($arrayCART[$id] as $key => $info)
  49.      {
  50.       //  DISPLAYS PER EACH ITEM FIELD  //
  51.       echo "\t" . '<tr>' . "\n";
  52.       echo "\t\t" . '<td>' . $key . ':' . $info . '</td>' . "\n";
  53.       echo "\t" . '</tr>' . "\n";
  54.       // // // // // // // // // // // // //
  55.     
  56.      }
  57.      // DISPLAYS INBETWEEN ITEMS AFTER //
  58.      echo "\t" . '<tr>' . "\n";
  59.      echo "\t\t" . '<td>&nbsp;</td>' . "\n";
  60.      echo "\t" . '</tr>' . "\n";
  61.      // // // // // // // // // // // // //
  62.     }
  63.     // DISPLAYS AFTER ORDER INFORMATION //
  64.     echo '</table>' . "\n";
  65.     // // // // // // // // // // // // //
  66.     
  67.     echo '<br>' . "\n";
  68.     echo '<br>' . "\n";
  69.     echo '<br>' . "\n";
  70.     
  71.     // If the form is submited we want to display the information they entered.
  72.     if ($_POST['submit'])
  73.     {
  74.     
  75.      // Process submition.
  76.      $f_name = $_POST['f_name'];
  77.      $f_addr = $_POST['f_addr'];
  78.      $f_city = $_POST['f_city'];
  79.      $f_state = $_POST['f_state'];
  80.      $f_zipcode = $_POST['f_zipcode'];
  81.      $f_phone = $_POST['f_phone'];
  82.      $f_email = $_POST['f_email'];
  83.     
  84.      // Put submited information into a varible to display (You dont really need to store if but its standard for me).
  85.      $message .= 'Name:' . $f_name . "<br>\n";
  86.      $message .= 'Address:' . $f_addr . "<br>\n";
  87.      $message .= 'City:' . $f_city . "<br>\n";
  88.      $message .= 'State:' . $f_state . "<br>\n";
  89.      $message .= 'Zip:' . $f_zipcode . "<br>\n";
  90.      $message .= 'Phone:' . $f_phone . "<br>\n";
  91.      $message .= 'Email:' . $f_email . "<br>\n";
  92.     
  93.      // Display the message.
  94.      echo $message;
  95.     
  96.     }
  97.     else
  98.     {
  99.      // If they have not submited there order then we want to give them the option too.
  100.     
  101.     
  102.      // THIS IS JUST A BUNCH OF HTML CODE DISPLAYED LINE BY LINE //
  103.      // THIS IS JUST A BUNCH OF HTML CODE DISPLAYED LINE BY LINE //
  104.      // THIS IS JUST A BUNCH OF HTML CODE DISPLAYED LINE BY LINE //
  105.     
  106.      // There is nothing really crazy about this code below, just standard html.
  107.      echo '     <h2>Continie Checkout</h2>' . "\n";
  108.      echo '     <table border="0" cellpadding="3" cellspacing="0" width="500" bgcolor="#EEEFEE" style="border: D6DFE8 solid 1px">' . "\n";
  109.      echo '      <tr valign="top">' . "\n";
  110.      echo '       <td></td><td><div class="noprint"><p align="left"><font face="Verdana" size="2" color="FF0000"><b>Info Text</b></font></div></td>' . "\n";
  111.      echo '      </tr>' . "\n";
  112.      echo '            <form method="post" name="myform">' . "\n";
  113.      echo '      <tr>' . "\n";
  114.      echo '       <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Name:</font></td>' . "\n";
  115.      echo '       <td width="251" height="31"><font face="Verdana" size="2">' . "\n";
  116.      echo '        <input maxlength=40 size=40 name="f_name" tabindex="1" value="">' . "\n";
  117.      echo '       </font></td>' . "\n";
  118.      echo '      </tr>' . "\n";
  119.      echo '      <tr>' . "\n";
  120.      echo '       <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Address:</font></td>' . "\n";
  121.      echo '       <td width="251" height="31"><font face="Verdana" size="2">' . "\n";
  122.      echo '             <input maxlength=40 size=40 name="f_addr" tabindex="2"> ' . "\n";
  123.      echo '             </font></td>' . "\n";
  124.      echo '      </tr>' . "\n";
  125.      echo '      <tr>' . "\n";
  126.      echo '       <td width="100" height="31"><font face="Verdana" size="2"> &nbsp;&nbsp;&nbsp;City:</font></td>' . "\n";
  127.      echo '       <td width="251" height="31"><font face="Verdana" size="2">' . "\n";
  128.      echo '        <input maxlength=20 size=20 name="f_city" tabindex="3"></font></td>' . "\n";
  129.      echo '      </tr>' . "\n";
  130.      echo '      <tr>' . "\n";
  131.      echo '       <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; State:</font></td>' . "\n";
  132.      echo '       <td width="251" height="31"><font face="Verdana" size="2">' . "\n";
  133.      echo '             <select name="f_state" tabindex="4">' . "\n";
  134.      echo '                 <option value="0">State...</option>' . "\n";
  135.      echo '                 <option value="Na">Other / Not USA</option>' . "\n";
  136.      echo '                 <option value="AL" >Alabama</option>' . "\n";
  137.      echo '                 <option value="AK" >Alaska</option>' . "\n";
  138.      echo '                 <option value="AZ" >Arizona</option>' . "\n";
  139.      echo '                 <option value="AR" >Arkansas</option>' . "\n";
  140.      echo '                 <option value="CA" >California</option>' . "\n";
  141.      echo '                 <option value="CO" >Colorado</option>' . "\n";
  142.      echo '                 <option value="CT" >Connecticut</option>' . "\n";
  143.      echo '                 <option value="DE" >Delaware</option>' . "\n";
  144.      echo '                 <option value="DC" >District of Columbia</option>' . "\n";
  145.      echo '                 <option value="FL" >Florida</option>' . "\n";
  146.      echo '                 <option value="GA" >Georgia</option>' . "\n";
  147.      echo '                 <option value="HI" >Hawaii</option>' . "\n";
  148.      echo '                 <option value="ID" >Idaho</option>' . "\n";
  149.      echo '                 <option value="IL" >Illinois</option>' . "\n";
  150.      echo '                 <option value="IN" >Indiana</option>' . "\n";
  151.      echo '                 <option value="IO" >Iowa</option>' . "\n";
  152.      echo '                 <option value="KS" >Kansas</option>' . "\n";
  153.      echo '                 <option value="KY" >Kentucky</option>' . "\n";
  154.      echo '                 <option value="LA" >Louisiana</option>' . "\n";
  155.      echo '                 <option value="ME" >Maine</option>' . "\n";
  156.      echo '                 <option value="MD" >Maryland</option>' . "\n";
  157.      echo '                 <option value="MA" >Massachusetts</option>' . "\n";
  158.      echo '                 <option value="MI" >Michigan</option>' . "\n";
  159.      echo '                 <option value="MN" >Minnesota</option>' . "\n";
  160.      echo '                 <option value="MS" >Mississippi</option>' . "\n";
  161.      echo '                 <option value="MO" >Missouri</option>' . "\n";
  162.      echo '                 <option value="MT" >Montana</option>' . "\n";
  163.      echo '                 <option value="NE" >Nebraska</option>' . "\n";
  164.      echo '                 <option value="NV" >Nevada</option>' . "\n";
  165.      echo '                 <option value="NH" >New Hampshire</option>' . "\n";
  166.      echo '                 <option value="NJ" >New Jersey</option>' . "\n";
  167.      echo '                 <option value="NM" >New Mexico</option>' . "\n";
  168.      echo '                 <option value="NY" >New York</option>' . "\n";
  169.      echo '                 <option value="NC" >North Carolina</option>' . "\n";
  170.      echo '                 <option value="ND" >North Dakota</option>' . "\n";
  171.      echo '                 <option value="OH" >Ohio</option>' . "\n";
  172.      echo '                 <option value="OK" >Oklahoma</option>' . "\n";
  173.      echo '                 <option value="OR" >Oregon</option>' . "\n";
  174.      echo '                 <option value="PA" >Pennsylvania</option>' . "\n";
  175.      echo '                 <option value="RI" >Rhode Island</option>' . "\n";
  176.      echo '                 <option value="SC" >South Carolina</option>' . "\n";
  177.      echo '                 <option value="SD" >South Dakota</option>' . "\n";
  178.      echo '                 <option value="TN" >Tennessee</option>' . "\n";
  179.      echo '                 <option value="TX" >Texas</option>' . "\n";
  180.      echo '                 <option value="UT" >Utah</option>' . "\n";
  181.      echo '                 <option value="VT" >Vermont</option>' . "\n";
  182.      echo '                 <option value="VA" >Virginia</option>' . "\n";
  183.      echo '                 <option value="WA" >Washington</option>' . "\n";
  184.      echo '                 <option value="WV" >West Virginia</option>' . "\n";
  185.      echo '                 <option value="WI" >Wisconsin</option>' . "\n";
  186.      echo '                 <option value="WY" >Wyoming</option>' . "\n";
  187.      echo '                </select></font></td>' . "\n";
  188.      echo '      </tr>' . "\n";
  189.      echo '      <tr>' . "\n";
  190.      echo '       <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Zip:</font></td>' . "\n";
  191.      echo '       <td width="251" height="31"><font face="Verdana" size="2">' . "\n";
  192.      echo '        <input maxlength=10 size=10 name="f_zipcode" tabindex="5">' . "\n";
  193.      echo '       </font></td>' . "\n";
  194.      echo '      </tr>' . "\n";
  195.      echo '             <tr>' . "\n";
  196.      echo '        <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; Phone#:</font></td>' . "\n";
  197.      echo '       <td width="243" height="31"><font face="Verdana" size="2">' . "\n";
  198.      echo '        <input maxlength=16 size=16 name="f_phone" tabindex="7">' . "\n";
  199.      echo '       </font></td>' . "\n";
  200.      echo '      </tr>' . "\n";
  201.      echo '      <tr>' . "\n";
  202.      echo '       <td width="100" height="31"><font face="Verdana" size="2">&nbsp;&nbsp; E-mail:</font></td>' . "\n";
  203.      echo '       <td width="253" height="31"><font face="Verdana" size="2">' . "\n";
  204.      echo '        <input maxlength=40 size=40 name="f_email" tabindex="8" value="">' . "\n";
  205.      echo '       </font></td>' . "\n";
  206.      echo '      </tr>' . "\n";
  207.      echo '      <tr>' . "\n";
  208.      echo '       <td colspan="2" width="520"><div class="noprint"><p align="center"><font face="Verdana" size="2">' . "\n";
  209.      echo '         <input type=submit value="Click Here to Submit" name=submit tabindex="9">' . "\n";
  210.      echo '       </font></p></div></td>' . "\n";
  211.      echo '      </tr>' . "\n";
  212.      echo '            </form>' . "\n";
  213.      echo '     </table>' . "\n";
  214.     }
  215. ?>


Basicly this will take an input

http://www.domain.com/pagename.php?phot ... escription

It will take that and store the information in a session array. Once the user is done they can fill out the form. Once they click submit it will display the content of the order and there information on the page. They can then print it off. You can add any more information you like. I commented it so you can understand what is going on. If you want it more styled you will have to do that yourself.
#define NULL (::rand() % 2)
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Jan 06, 2006
  • Posts: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Post June 25th, 2007, 5:31 pm

?
  • SB
  • Moderator
  • Genius
  • User avatar
  • Joined: Nov 16, 2004
  • Posts: 8677
  • Loc: Aberdeen, Scotland
  • Status: Offline

Post June 25th, 2007, 5:42 pm

Brian, if you quote Spoofs last message it shows you the code that he typed in. Just remember to remove the quote tags etc etc.

Very odd that you have to do this, but this was how i saw what Spoof had typed.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 25th, 2007, 5:42 pm

Post Information

  • Total Posts in this topic: 23 posts
  • Users browsing this forum: No registered users and 116 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.