ctsiow Posted September 7, 2007 Share Posted September 7, 2007 Hi all First post so here goes. I am trying to put together a form that gets a list of items from a database and displays them in a table in a form. I have 3 tables, one main one with id, pic, description etc. one table with size options for some of the items, if the items has any, and one with colour options, again if there are any. They all tie up using the id for each item, for example: main table id - sss, name - short sleeve shirt, description - a short with short sleeves, price - 9.90 size table id - sss, size1 - small id - sss, size2 - large ...... colour table id - sss, colour1 = red id - sss, colour2 = black ... What I am trying to do is for people to be able to order items that have options such as colour and/or size using a dynamic drop-down list and to use a radio button to say which item they want. At the moment I want to get the id of the item into the next page and then display the info in a new table for this item. (The form is using method="post" so I can get the id passed over, if only I can get the right id!) The table is being created ok but I can not work out how to get the name of the radio button to include the item id code. Once on the new page I would like to then put on the drop-down / select choices then add this to a list of items they want to order. Once they have ordered all they want to they then see the final order the I want to pass this into a page with the mail() function, there is no payment taken on this site, the order info gets emailed and an invoice will be sent out later. Any help is appreciated. Mark Quote Link to comment https://forums.phpfreaks.com/topic/68321-help-with-dynamic-form-mysql/ Share on other sites More sharing options...
gerkintrigg Posted September 7, 2007 Share Posted September 7, 2007 could you not use a number of while loops to render the table properly and nest those inside a mysql_fetch_array command? so: $q="/*SQL QUERY HERE*/"; $sql=mysql_query($q); echo '<table>'; while($r=mysql_fetch_array($sql)){ /* table formatting here using counters, auto incrementers (like $i++ and while loops*/ } echo '</table>'; Then for each URL, do something like: <a href="index.php?id='.$r['item_id'].'">Link code</a> When you get to the index.php (or whatever page you're going to using the link) use $_REQUEST['id'] to get the item id from the posted variable. Hope it helps. Quote Link to comment https://forums.phpfreaks.com/topic/68321-help-with-dynamic-form-mysql/#findComment-343533 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.