echeats Posted March 9, 2008 Share Posted March 9, 2008 I have an order form which had 5 part that repeated themselves to allow a person to order up to 5 different items. I originally did it by having $item1, $quantity1, $type1, $item2, $quantity2...etc hardcoded into both the PHP processor and the HTML form (e.g. values of form elements were item1, quantity1, etc). I have now re-coded it so it uses arrays for both the HTML form (the parts that repeat are in the array) and the PHP processor, and all is working fine. Both currently use a variable $itemamount = 5 which is hardcoded into the script. The only thing is, now i have my arrays i was wondering if i can make it so users can somehow input/specify how many items they wish to add? Ideally i don't want to use POST as the form using the arrays has an "if POST" thing that it could mess up. The other slightly problem is that the page is included in a larger CMS type system which means using GET is impossible as you can't get the value into the URL (e.g. by using form.php?itemamount=3)...so i wondered if theres another way of doing this? Basically i either want a seperate page that asks the user how many items he/she wants to order, which then forwards them onto form.php that will give them the form to fill in. Alternatively, if all the code was on the form page and they (by default) have 1 item field and could then somehow click "Add Item..." if they wished to add more and more as many times as they want? So, any ideas? I'm a little stuck so appreciate any help! Quote Link to comment 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.