Jump to content


PHP Order Form

  • Please log in to reply
3 replies to this topic

#1 stualk

  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 18 October 2006 - 05:34 PM

Hi Chaps,

I have a site which calls in products from a database and displays them on a page. What I've now done is to create a hyperlink from the product code of each product to an order form, so effectively you can add an item to the order form. So far so good with this. The hyperlink takes the values '$item_number' and '$product_name' into the PHP order form.

Up to now this works perfectly but people can only add one item to the order form. How can I make sure that my order form adds a new row and the relevant boxes each time someone updates their order by clicking on another item?

Here's the code of the order form (I only have one row currently in the table that displays the products):


<form name=\"form1\" method=\"post\">
<input type=\"hidden\" name=\"action\" value=\"addscript\" size=\"20\">
<table width='580' border='1' cellpadding='2' cellspacing='0' bordercolor='#000000'>
  <tr valign='top'>
    <td width='70%'><div align='center'><font size='2'><strong>Product Description</strong></font></div>
    <td width='15%'><div align='center'><font size='2'><strong>Product Code</strong></font></div></td>
    <td width='15%'><div align='center'><font size='2'><strong>Quantity</strong></font></div></td>
    <td width='70%'><input name='desc11' type='text' id='desc11' value='$product_name' size='45'></td>
    <td width='15%'><div align='center'>
      <input name='code11' type='text' id='code11' value='$item_number' size='20'>
    <td width='15%'><div align='center'>
      <input name='qty11' type='text' id='qty11' size='5'>
    <td><div align='center'>
      <input type='submit' name='Submit' value='Submit Order'>
    <td><div align='center'>
      <input type='reset' name='Submit2' value='Reset'>


Any know how best I can achieve this?


#2 HuggieBear

  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 19 October 2006 - 08:26 AM

When you say 'adding to the order form', are you storing this information somewhere, like in the database?

Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#3 xsist10

  • Members
  • PipPipPip
  • Advanced Member
  • 114 posts

Posted 19 October 2006 - 08:45 AM

What you want is a shopping cart.

You need to keep track of a number of selections and assocciate them with a session_id/ip_address/username (if applicable).
Then when they "check-out" the shopping cart you can create a dynamic form with all the items from their shopping cart.

Have a look at these links for some ideas:
SA PHP Archives - www.phparchives.za.org

#4 redarrow

  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 October 2006 - 08:48 AM


do it your self good luck.
Wish i new all about php DAM i will have to learn

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users