gpt4 book ai didi

php - 如何将字符串与选项值进行比较

转载 作者:行者123 更新时间:2023-11-29 06:22:04 25 4
gpt4 key购买 nike

我有这个 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")

最佳答案

if($_POST['general'] == 'ADDRESS')

关于php - 如何将字符串与选项值进行比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2672084/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com