Jump to content

Archived

This topic is now archived and is closed to further replies.

stualk

Arrays

Recommended Posts

Hi Chaps,

I posted about this before but didn't explain it properly.

If I have a PHP page displaying products from a database how can I create a separate order form that captures the item numbers of the products a customer selects?

So far I have got this to work but the order form only captures one item number. If you then select another product to add to the order form it overwrites the previous one.

I'm almost there but I think it's an array I need to use in the form, take a look at my code and see what you think. This is the hyperlink from the products page:

[code]<a href=javascript:MM_openBrWindow('order_form.php?clientid=$clientid&&item_number=$item_number','enlarge','width=620,height=550,resizable=yes,status=no,toolbar=no,scrollbars=yes')><i>$item_number</i></a>[/code]

And here's the code i'm using in the form...

[code]
<?php
if ($action =="" || $action=="default") {

print("
<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='50'></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>&nbsp;</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]

What's the best way to make it capture more than one order?

Thanks

Share this post


Link to post
Share on other sites
Please post the PHP script you're using to process the form.

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.