有人可以指出为什么以下不起作用?即使我选择不同的单选按钮,它也只会重定向到第一个位置。
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>