drop-down box and if statements...<

liunx

Guest
Hi all,

Can someone help me...
I have a drop-down menu (which has "yes" and "no" then I have a submit button... and when they click "submit" I want to have some IF statements but how do I refer to the yes/no drop down in the if statements??? ... simple problem but hard to explain ...look at what I have...


if ($option = 'yes')
{
do something
}


but if yes was entered it doesn't do what it is meant to do
is it correct having 'yes'?

Thanks,
Mikeif ($_POST['select_name'] == 'yes')
{
do something
}


the select tag has a name and that name has the value of the option. you have to have option values too.I already have this elsewhere...

$option = $_POST['dropDown'];


so I dont need it again do I?no, then this would work

if ($option == 'yes')
{
do something
}Ok Thanks,

But what if I have more then one word in the dropdown... like a whole line of words... will it still work like this


if ($option == 'yes ... blah blah blha')
{
do something
}


the reason I am asking is because I have another dropdown box with a whole line of words and it doesn't seem to work...

Thanks,
Mikeok, lets refer to hat I said before.
the select tag has a name and that name has the value of the option. you have to have option values too.
if you do not have a value of the options then i twill not work.

<select name="select_name">
<option value="first_value">some long text here</option>
</select>

see that? this is what gets sent.

select_name = first_value

what is the code you have if you are doing it this way?Ok I understand now...

but what should I have $_POST or $_GET

Thanks,if you send it in a form and that forms method is POST then you use _POST but i fyou send it in the url then it is _GET
 
Back
Top