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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lassoloc
Forum Newbie
Posts: 2
Joined: Sun Nov 28, 2010 8:31 pm

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

Post 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?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

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

Post 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.
lassoloc
Forum Newbie
Posts: 2
Joined: Sun Nov 28, 2010 8:31 pm

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

Post 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?
Post Reply