A few simple PHP questions...

Rightio, didn't realise you couldn't redirect the user back to the page and keep the POST data.

Another problem i have is that this "order form" im creating will sometimes need to order more than one item. At the moment my form and PHP processor can handle one item only, i could quite easily create 10 more forms and PHP processors that would allow up to 10 items to be ordered but surely thats a pants way of doing it?!

So next question, how can i "add" extra field to a form if a user clicks a link that says (add another item..) or something similar? And then how can i adjust my PHP script on the backend to accept any additional items and process them?
 
I'll clarify a little. When we order bit's it will usually only be one or two items, so my form currently looks like this:

Delivery Address: __________________ (select box)
Ref Number: ______________________ (text box)
Customer Email: ___________________ (text box)

Item 1
Product: _________________________ (select box, e.g. Printer, PC, TFT)
Quantity: ________________________ (select box)
Type: Replacement __ Enhancement __ (radio buttons)
Old assets: _______________________ (text box)

Other Notes: ______________________ (text box)


Obviously the current problem is, what happens if i want to order 2xPrinter's as well as 2xPC's and 2xTFT's and 2xEthernet Cables? I'd have to submit that request and then complete the form again and again for the next items! Rubbish!

So my main question is, lets say my PHP currently does this:

Code:
echo $deladdress;
echo $refnumber;
echo $custemail;

echo $item1;
echo $quantity1;
echo $type1;
echo $oldassets1;

echo $notes;

How can i change it to, for example, loop through looking for (and echo'ing)other items like $item2, $quantity2, $type2, $oldassets2, $item3, $quantity3...etc...?
 
Back
Top Bottom