How to compare a string with an option value

Posted by user225269 on Stack Overflow See other posts from Stack Overflow or by user225269
Published on 2010-04-20T02:03:21Z Indexed on 2010/04/20 2:13 UTC
Read the original article Hit count: 268

Filed under:
|

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")

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql