我正在尝试重定向到一个页面,但基于选择框的答案。基本上在下面的示例中,如果在通过按钮提交表单时选择了 p1,如何使页面重定向到“thispage.php”,如果选择 p2,如何使页面重定向到“thatpage.php”?我感谢所有评论,谢谢。
<html>
<body>
<form name="form1">
<select name="select1">
<option value="p1">p1</option>
<option value="p2">p2</option>
<input type="submit"/>
</select>
</form>
</body>
</html>
Basic:
<?PHP
function redirect($where){
header("Location: $where");
}
if ($_REQUEST['select1'] == 'p1'){
redirect('http://example.com/somewhere.php');
}elseif($_REQUEST['select1'] == 'p2'){
redirect('http://example.com/elsewhere.php');
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)