Hi all
My first post so here goes 🙂
I am trying to build a web form that a user can choose items from a mysql database. I can create a dynamic table that will get the info from the database and load the pictures ok. What I would now like to do is to be able to have some items with different options selectable by the user. Does that make sense?
For example, a shirt has different sizes and different colours so what I want to do is use a dropdown that has been populated from the database for each of the option types.
I am playing with a separate table for these options called accSize and another called accColour. These entries have the corresponding id to the entries in the main table accMain, so accID sss is a short sleeve shirt, it has colour entries of black, red and blue and sizes of s, m, l and xl. these entries look like this:
table accMain:
accID = sss
description = Short sleeve shirt
image = ....

table accColour:
accID = sss
accColour1 = black
accColour2 = red
accColour3 = blue

tabe accSize:
accID = sss
accSize1 = s
accSize2 = m
accSize3 = l
accSize4 = xl

So is it possible to add all these parts to a form and have it tied to hidden fields so it can be sent as an email? (There is no payment on the site, we just want to email a completed order, or rather a list of stuff people want).

Does all this make sense? Hope someone can help me to achieve this lot, it may not be feasible, if you experts know I am trying the impossible, please let me know!😕

Thanks in advance
Mark

    use a <select>

    connect to the db, retrive the values from the table and use a while() loop:

    while($row = mysql_fetch_array($resultofquery)) {
    echo '<option value="'.$row['size_id'].'">'.$row['size_description'].'</option>';
    }
    

      Hi TobyRT
      Thanks I will give this a go. One other point, meant to say that not all items have options, some are things like packs of pens, only available in a pack of 50 type of thing. I was not going to add entries for these in the options tables. Does this alter the use of your code?
      Thanks
      Mark

        Write a Reply...