0

I have this html form which has options:

<tr>
<td width="30" height="35"><font size="3">*List:</td>
<td width="30"><input name="specific" type="text" id="specific" maxlength="25" value="">
</td>

<td><font size="3">*By:</td>
<td>
    <select name="general" id="general">
        <font size="3">
        <option value="YEAR">Year</option>
        <option value="ADDRESS">Address</option>


    </select></td></td>
    </tr>

And I'm trying to have this as the form action:

if ('{$_POST["ADDRESS"]}'="ADDRESS")

Which will compare if the value in the option in the html form matches the word "Address". If it matches then it will execute this query:

$saddress= mysql_real_escape_string($_POST['specific']);<--this is the input form where the user will put the specific address to search.

mysql_query("SELECT * FROM student WHERE ADDRESS='$saddress'");

Please I need help in here, I thinks its wrong:

if ('{$_POST["ADDRESS"]}'="ADDRESS")
user225269
  • 10,743
  • 69
  • 174
  • 251

2 Answers2

3
if($_POST['general'] == 'ADDRESS')
Puaka
  • 1,751
  • 13
  • 8
0
$test=strcmp($_POST['general'],"ADDRESS");
if($test==0)
{
    //Here you can write your operations.
}
Taryn
  • 242,637
  • 56
  • 362
  • 405