Jump to content

Help with dynamic form / mysql


ctsiow

Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.