Jump to content


Photo

Form Problem


  • Please log in to reply
2 replies to this topic

#1 davinci

davinci
  • Members
  • PipPip
  • Member
  • 29 posts

Posted 12 March 2006 - 06:25 PM

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:

<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>

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?

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 12 March 2006 - 06:31 PM

The field name is in the SELECT line. Your OPTION lines should not have a name at all.

<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>

Legend has it that reading the manual never killed anyone.
My site

#3 davinci

davinci
  • Members
  • PipPip
  • Member
  • 29 posts

Posted 12 March 2006 - 06:38 PM

Ok, I'm an idiot.

:P

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






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users