我有这个html表单,其中包含选项:
<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>
我正试图将此作为表单操作:
if ('{$_POST["ADDRESS"]}'="ADDRESS")
如果html表单中的选项中的值与单词“Address”匹配,则会进行比较。如果匹配则执行此查询:
$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'");
我在这里需要帮助,我认为错了:
if ('{$_POST["ADDRESS"]}'="ADDRESS")
答案 0 :(得分:3)
if($_POST['general'] == 'ADDRESS')
答案 1 :(得分:0)
$test=strcmp($_POST['general'],"ADDRESS");
if($test==0)
{
//Here you can write your operations.
}