Page 1 of 1

creating "order form" using php to retrieve data from mysql

Posted: Sun Nov 28, 2010 9:08 pm
by lassoloc
I have items in a table with fields like item_id, item_name, and item_price.

I need help with creating text fields for each of the items that I list using the table in the database so customer can enter the quantity they want to order. After the customer goes through each item, they will click submit and the page will generate an order form that list the details of the transaction. (for example it list the items order, the quantity of each item, the price, and all calculations).

What approach would you take to do this?

Re: creating "order form" using php to retrieve data from my

Posted: Sun Nov 28, 2010 9:21 pm
by Celauran
Fetch the fields you need from the database, create your table on the fly as you loop through the results and use the product id as the name for the quantity input field, then post the form and do whatever you need to do with it.

Re: creating "order form" using php to retrieve data from my

Posted: Sun Nov 28, 2010 9:58 pm
by lassoloc
Celauran wrote:Fetch the fields you need from the database, create your table on the fly as you loop through the results and use the product id as the name for the quantity input field, then post the form and do whatever you need to do with it.
When you say post the form then do whatever you need to do with it. do you mean use $_POST for every single "name" that is not null? Say I have over 100 items and growing and the customer orders 50 items with unique ids, how am i able to reference each id after user hits submit?