stualk Posted October 18, 2006 Share Posted October 18, 2006 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):[code]<?phpprint("<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> <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> </tr> <tr> <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'> </div></td> <td width='15%'><div align='center'> <input name='qty11' type='text' id='qty11' size='5'> </div></td> </tr> <tr> <td> </td> <td><div align='center'> <input type='submit' name='Submit' value='Submit Order'> </div></td> <td><div align='center'> <input type='reset' name='Submit2' value='Reset'> </div></td> </tr></table></form>");?>[/code]Any know how best I can achieve this?Thanks Quote Link to comment https://forums.phpfreaks.com/topic/24355-php-order-form/ Share on other sites More sharing options...
HuggieBear Posted October 19, 2006 Share Posted October 19, 2006 When you say 'adding to the order form', are you storing this information somewhere, like in the database?RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/24355-php-order-form/#findComment-111112 Share on other sites More sharing options...
xsist10 Posted October 19, 2006 Share Posted October 19, 2006 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:[url=http://php.resourceindex.com/Complete_Scripts/Shopping_Carts/]http://php.resourceindex.com/Complete_Scripts/Shopping_Carts/[/url][url=http://www.shop-script.com/]http://www.shop-script.com/[/url] Quote Link to comment https://forums.phpfreaks.com/topic/24355-php-order-form/#findComment-111119 Share on other sites More sharing options...
redarrow Posted October 19, 2006 Share Posted October 19, 2006 http://www.phpwebcommerce.com/do it your self good luck. Quote Link to comment https://forums.phpfreaks.com/topic/24355-php-order-form/#findComment-111120 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.