Database Insert question

I can happily insert form data into the database until I come to a dropdown choice.

I have this bit

Category: <select name="maincat">
<option value="cardmaking">Choose category</option>
<option value="cardmaking">Card Making</option>
<option value="painting">Painting</option>
<option value="toymaking">Toy Making</option>
<option value="dont">Don't Know</option>

and then this bit…

gallery (title, description, step1, step2, step3, step4, step5, step6, step7, step8, step9, step10, image1, id, spare, maincat)
if (!mysql_query($sql,$con))
  die('Error: ' . mysql_error());
echo "1 record added";

How do I get the users selection to be added to the database?

Can anyone help please?

Thanks for the advice guys - I still have much to learn :slight_smile:

You may have fixed that issue , but its not fixed in our term .

This code will bring SQL injection . Use atleast mysql_real_escape_string .

Better Tips:

Also think about using numerical IDs instead of the text values.
It may be your category ID. Use the category name text for display only.

Don’t worry I have fixed it. Sorry for rubbish post.