我有个问题。我在使用 PHP 时遇到了一点问题IF ELSE
。我有一个条件,当我在下拉列表中选择“全部”时,保存按钮将被禁用,并且它正在工作。但是,当我选择“顶部”时,保存按钮已启用,但并未进入下一页。
在我将它放入之前IF ELSE
,保存按钮正在工作,但是当我将它放入IF ELSE
保存按钮时,没有在下一页继续。
下面是我的代码:
$dropdown_value = (string)$_POST["id"];
if ($dropdown_value == 'All')
{
echo "<input type='submit' name='save' value='Save' disabled onClick='this.form.action='save_data.php'; this.form.submit()'> ";
$all = mysql_query("SELECT fldBldgName FROM tblbuildings");
while ($row = mysql_fetch_array($all))
{
echo "<div><input type='checkbox' name='play[]' class='chk_boxes1' value='" . $row['fldBldgName']."'>";
echo $row['fldBldgName'];"</div>";
}
}
else if ($dropdown_value == 'Top')
{
echo "<input type='submit' name='save' value='Save' onClick='this.form.action='save_data.php'; this.form.submit()'> ";
echo "<div><input type='checkbox' class='checkall'> Check all</div>";
$top = mysql_query("SELECT fldBldgName FROM tblbuildings ORDER BY fldBldgName ASC LIMIT 30");
while ($row = mysql_fetch_array($top))
{
echo "<tr><td>";
echo "<div><input type='checkbox' name='play[]' class='chk_boxes1' value='" . $row['fldBldgName']."'>";
echo $row['fldBldgName'];"</div>";
echo "</td></tr><br/>";
}
}