Jump to content


Photo

Arrays


  • Please log in to reply
1 reply to this topic

#1 stualk

stualk
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 19 October 2006 - 08:26 AM

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:

<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>

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

<?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>
");
?>

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

Thanks

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 19 October 2006 - 01:32 PM

Please post the PHP script you're using to process the form.

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users