December 6th, 2012, 06:54 PM
I really need to be pointed in the right direction
I am building a script for receipts. What I need to do is set up 3 text boxes for the ingredient, the amount, and measure amount.
Not knowing how many ingredients will be called for I need to be able to click on a next ingredient button and have a new row of test boxes show on the page. This will need to happen for each ingredient. I will then save it to an array in a db.
Can anyone give me some advice please.
December 6th, 2012, 07:01 PM
December 6th, 2012, 07:18 PM
a) Name the textboxes like "ingredient", "amount", and "measure". Then $_POST["ingredient"] and all will be arrays, not just single strings. Loop over them.
b) Name the textboxes like "ingredient[name]", "ingredient[amount]", and "ingredient[measure]". Then $_POST["ingredient"] will be an array, and each of those will be arrays with the name, amount, and measure. The 123 can come from anywhere but it has to be unique for each row.
December 6th, 2012, 07:19 PM