Jump to content

Archived

This topic is now archived and is closed to further replies.

davinci

Form Problem

Recommended Posts

I have form to upload news. Works well but I'm trying to add a drop down box to select the category. I've created a column called category in my news table. For the form I am using this code:

[code] <tr><td>
<select name="category" style="border: 1px solid #000000">
<option name="Type" option value="Type">Type..</option>
<option name="Ad" option value="Ad">Ad</option>
<option name="Video" option value="Video">Video</option>
<option name="Gallery" option value="Gallery">Gallery</option>
<option name="News" option value="News">News</option>
<option name="Other" option value="Other">Other</option>
</select></td>
</tr><br>[/code]

But whenever I try to use it I get the error:

Error, query failed : Unknown column 'Video' in 'field list' (or instead of video, whichever value I selected).

What am I doing wrong here?

Share this post


Link to post
Share on other sites
The field name is in the SELECT line. Your OPTION lines should not have a name at all.

[code]<select name="category" style="border: 1px solid #000000">
<option value="Type">Type..</option>
<option value="Ad">Ad</option>
<option value="Video">Video</option>
<option value="Gallery">Gallery</option>
<option value="News">News</option>
<option value="Other">Other</option>
</select>[/code]

Share this post


Link to post
Share on other sites
Ok, I'm an idiot.

:P

I forgot the " ' " marks around '$category' in my query. So sorry to waste your time!

Share this post


Link to post
Share on other sites

×

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.