How to compare a string with an option value
- by user225269
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")