【发布时间】:2013-09-16 06:14:22
【问题描述】:
有人可以指出为什么以下内容不起作用吗?即使我选择不同的单选按钮,它也只会重定向到第一个位置。
PHP:
if (isset($_POST['submit'])) {
if (!empty($_POST['electronics'])) {
if ($_POST['electronics'] = "camera") {
header("location: camera.php");
exit();
}
if ($_POST['electronics'] = "cell") {
header("location: cellphones.php");
exit();
}
if ($_POST['electronics'] = "cable") {
header("location: cables.php");
exit();
}
if ($_POST['electronics'] = "tv") {
header("location: tv.php");
exit();
}
}
...
HTML:
<form action="" method="post">
<input type="radio" name="electronics" value="cell"/>
<input type="radio" name="electronics" value="camera"/>
<input type="radio" name="electronics" value="cable"/>
<input type="radio" name="electronics" value="tv"/>
<input type="submit" name="submit">
</form>
【问题讨论】:
-
= !== ===是我能想到的最好的了
标签: php html forms radio-button