if statement from dropdown menu

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ganza
Forum Newbie
Posts: 19
Joined: Fri Nov 07, 2008 3:56 am

if statement from dropdown menu

Post by ganza »

hi all,

is it possible for me to make an if statement from dropdown menu value?
so example like this

Code: Select all

<form id="Status" name="Status" method="post" action="">
  <select name="status" >
  <option value="0" selected="selected">SELECT!</option>
  <option value="1">one</option>
  <option value="2">two</option>
  <option value="3">three</option>
  </select>
</form> 
 
and i want to made an if statement using the value of the dropdown menu
 
if(isset($_REQUEST["Submit"]) == true) && ($_REQUEST["value"]) == 1)
{ 
i try the code like that and it isnt working ....
ramya123
Forum Newbie
Posts: 13
Joined: Thu Sep 11, 2008 6:11 am

Re: if statement from dropdown menu

Post by ramya123 »

use name of dropdown i.e.,($_REQUEST["status"])
instead of ($_REQUEST["value"])
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: if statement from dropdown menu

Post by pcoder »

You can easily make an if statement from the dropdown value.
Try this to test the request value.

Code: Select all

print_r($_REQUEST);
Then you can control the statement.
8)
Post Reply