multidimensional array/order form help
Posted: Wed Dec 10, 2014 4:27 pm
Hi everyone, new guy here. I am relatively new to php but I'm trying to create an order form that puts user data in a mysql database.
Now, here's the functionality that I am having a hard time figuring out:
I want them to go to the order form page (let's call it orderpage.php)
On the order page, to make this example simple, lets say there are 3 fields- 'first_name' , 'last_name' , and a drop down menu called 'product_of_choice'
So for example the customer puts "John" ... "Smith" ... "Large pepperoni pie"
But then he also has a friend named Steve Urkel who wants a medium sausage pie, and he wants to add this info to his order.
Now, I don't want anything submitted into the database until they have every single one of their order forms filled out at the same time, so I want John Smith to be able to click a button called "Add another person" at the bottom of the page.
Also I want them to be able to add as many people as they would like.
How do I make this possible, and keep in mind that I want each person's info to go on separate rows in the database. So John Smith and Steve Urkel need to go on separate rows. They should receive the same $order_number but a separate $Unique_ID_number
I have done a fairly extensive amount of research, I mean a lot, and I just cant get a grasp on exactly how to write this code. I have come to the understanding that I need to use sessions, multidimensional arrays, foreach loops and whatever else, but I just can not for the life of me, figure out how to put these things into effect.
Also I'm not asking anyone to write my website for free so please don't think that. If you feel that you would be doing my work for me by answering this question, then tell me how much I need to pay in order to have this answered in a way that I can understand. Just please dont respond by saying "you need to use sessions and arrays" because I know that already. Just can't put this puzzle together properly.
Thanks in advance for any help I may receive and I apologize for the noobishness of these questions.
-Billy
Now, here's the functionality that I am having a hard time figuring out:
I want them to go to the order form page (let's call it orderpage.php)
On the order page, to make this example simple, lets say there are 3 fields- 'first_name' , 'last_name' , and a drop down menu called 'product_of_choice'
So for example the customer puts "John" ... "Smith" ... "Large pepperoni pie"
But then he also has a friend named Steve Urkel who wants a medium sausage pie, and he wants to add this info to his order.
Now, I don't want anything submitted into the database until they have every single one of their order forms filled out at the same time, so I want John Smith to be able to click a button called "Add another person" at the bottom of the page.
Also I want them to be able to add as many people as they would like.
How do I make this possible, and keep in mind that I want each person's info to go on separate rows in the database. So John Smith and Steve Urkel need to go on separate rows. They should receive the same $order_number but a separate $Unique_ID_number
I have done a fairly extensive amount of research, I mean a lot, and I just cant get a grasp on exactly how to write this code. I have come to the understanding that I need to use sessions, multidimensional arrays, foreach loops and whatever else, but I just can not for the life of me, figure out how to put these things into effect.
Also I'm not asking anyone to write my website for free so please don't think that. If you feel that you would be doing my work for me by answering this question, then tell me how much I need to pay in order to have this answered in a way that I can understand. Just please dont respond by saying "you need to use sessions and arrays" because I know that already. Just can't put this puzzle together properly.
Thanks in advance for any help I may receive and I apologize for the noobishness of these questions.
-Billy