Page 1 of 1

Help? Before I explode with drop menu

Posted: Tue Aug 26, 2003 9:43 pm
by illmapu
Hi,

I've looked through the php normal forum for an answer for several hours, but still no luck.

I have a simple form that the user adds their website and title, but I am trying to add a drop menu of categories for them to choose from.

The problem I 'm having is that the website and title are going into the db, but I cannot for the life of me, get info from the drop menu to go into the db too.

Can anyone help? :oops:

Thanks in advance!

Posted: Tue Aug 26, 2003 10:20 pm
by JAM

Code: Select all

<select name="foo">
 <option>Something
 <option>Else
 <option>Other
</select>
When submitting the form, $_POST['foo'] will have a value of one of the 3 above... Hope it helped.

Posted: Wed Aug 27, 2003 9:37 am
by liljester
illmapu: could you post some of your code so we can see whats going on?

Posted: Wed Aug 27, 2003 9:44 am
by patrikG
JAM wrote:

Code: Select all

<select name="foo">
 <option>Something
 <option>Else
 <option>Other
</select>
When submitting the form, $_POST['foo'] will have a value of one of the 3 above... Hope it helped.
Nope, that's not entirely correct. As posted above $_POST['foo'] would be empty.

Code: Select all

<select name="foo">
<option value="Chad">Chad
<option value="Chile">Chile
<option value="China">China
<option value="Colombia">Colombia
</select>
Provided the form-values are submitted via POST, $_POST['foo'] will have the value of the option the user selected.

Posted: Wed Aug 27, 2003 10:13 am
by volka
not true.
http://www.w3.org/TR/html4/interact/forms.html#edef-OPTION
value = cdata [CS]
This attribute specifies the initial value of the control. If this attribute is not set, the initial value is set to the contents of the OPTION element.
But please, could you close the tags you've opened? ;)

Code: Select all

<select name="foo">
	<option>Something</option>
	<option>Else</option>
	<option>Other</option>
</select>

Posted: Wed Aug 27, 2003 10:15 am
by patrikG
Excellent. I didn't know that. Thanks, Volka :)

Posted: Wed Aug 27, 2003 10:20 am
by JAM
For PatrikG, a link.
But please, could you close the tags you've opened?
Of course, I should. It's becomming a bad habit when I do testing... (As picture shows)... =/

/me slaps self...

Thank you!

Posted: Fri Aug 29, 2003 1:17 am
by illmapu
I appreciate everyones feedback. I discovered what I was doing wrong and won't ever forget it again!

Simply put, after hours and hours of sitting in front of my pc, I realized that I never put the name of the drop box into my sql query to insert as I did with everything else in the form, so that's why it wasn't posting.. Chalk it up to too many hours :oops:

8O