Php 复选框不';无法发送到正确的url
当我检查这张表格时,我总是选择谷歌选项,不管是哪种组合。我不知道我做错了什么。我在另一个案例中使用相同的表单作为复选框。1-6永远是谷歌。即使没有配置的多选也是谷歌的Php 复选框不';无法发送到正确的url,php,html,css,forms,checkbox,Php,Html,Css,Forms,Checkbox,当我检查这张表格时,我总是选择谷歌选项,不管是哪种组合。我不知道我做错了什么。我在另一个案例中使用相同的表单作为复选框。1-6永远是谷歌。即使没有配置的多选也是谷歌的 .pic{ background: url("#") no-repeat; width:616px; height:525px; position: relative; } input[type="checkbox"] {
.pic{
background: url("#") no-repeat;
width:616px;
height:525px;
position: relative;
}
input[type="checkbox"] {
transform:scale(1.3, 1.3);
}
.poin1{
left: 548px;
bottom:59px;
position: absolute;
}
.poin2{
left: 540px;
bottom:155px;
position: absolute;
}
.poin3{
left: 500px;
bottom:265px;
position: absolute;
}
.poin4{
left: 495px;
bottom:325px;
position: absolute;
}
.poin5{
left: 479px;
bottom:385px;
position: absolute;
}
.poin6{
left: 465px;
bottom:460px;
position: absolute;
}
<form method="post" action="../includes/messung_jeans.php"> <div class="pic">
<input type="checkbox" id="cb1" name="cb1" value="m1" class="poin1">
<input type="checkbox" id="cb2" name="cb2" value="m2" class="poin2">
<input type="checkbox" id="cb3" name="cb3" value="m3" class="poin3">
<input type="checkbox" id="cb4" name="cb4" value="m4" class="poin4">
<input type="checkbox" id="cb5" name="cb5" value="m5" class="poin5">
<input type="checkbox" id="cb6" name="cb6" value="m6" class="poin6">
</div>
<div class="buttonHolder">
<input type="submit" name="send" <a class="btn primary-button" value="Weiter" /> </a>
</div>
<?
if($_POST['cb1'] == m1){
header("Location: http://www.google.com");
}
elseif($_POST['cb2'] == m2 ){
header("Location: http://www.yahoo.com");
}
elseif($_POST['cb2'] == m2 && $_POST['cb1'] == m1 ){
header("Location: http://www.bild.de");
}
elseif($_POST['cb3'] == m3 ){
header("Location: http://www.bing.com");
}
elseif($_POST['cb4'] == m4 ){
header("Location: http://www.bing.com");
}
elseif($_POST['cb5'] == m5 ){
header("Location: http://www.bing.com");
}
elseif($_POST['cb6'] == m6 ){
header("Location: http://www.bing.com");
}
else {
header("Location: http://www.floridataxreduction.com");
}
?>
.pic{
背景:url(“#”)不重复;
宽度:616px;
高度:525px;
位置:相对位置;
}
输入[type=“checkbox”]{
变换:比例(1.3,1.3);
}
poin1先生{
左:548px;
底部:59px;
位置:绝对位置;
}
波因2先生{
左:540px;
底部:155px;
位置:绝对位置;
}
poin3先生{
左:500px;
底部:265px;
位置:绝对位置;
}
poin4先生{
左:495px;
底部:325px;
位置:绝对位置;
}
彭先生5{
左:479px;
底部:385px;
位置:绝对位置;
}
彭先生6{
左:465px;
底部:460px;
位置:绝对位置;
}
我认为我们不需要你的CSS。这有点让人分心,我认为我们不需要你的CSS。这有点让人分心。谢谢你,这成功了!但是:elseif(isset($_POST['cb2'])和&isset($_POST['cb1']){header(“Location:);}----如果我尝试一下这个,它又是谷歌的。你能解释一下为什么上面的海报使用exit()以及为什么使用这个结构吗?更好的是什么?在上面的海报中使用exist()不需要。因为如果条件为真,它将重定向到标题位置,而不是检查另一个条件…啊,我看到了,这意味着他的退出是无用的,如果我将来需要1,2和3,因为它将在1&2@filledat是的,它需要在那个里格式化数据和会话,并阻止对脚本其余部分的任何恶意请求。请在你说什么之前,在你改变主意之前,最好的答案是什么,不要听初学者的意见,最好去php网站,了解更多关于header()和exit()的信息来自专家。http://php.net/manual/en/function.header.php
http://stackoverflow.com/questions/2747791/why-i-have-to-call-exit-after-redirection-through-headerlocation-in-php
http://stackoverflow.com/questions/8665985/php-utilizing-exit-or-die-after-headerlocation
谢谢,这很有效!但是:其他(isset($_POST['cb2'])和&isset($_POST['cb1']){header(“Location:);}----如果我试试这个,它又是谷歌的。你能解释一下为什么上面的海报使用exit()以及为什么使用这个结构吗。有什么更好的方法吗?在上面的海报中使用exist()不需要。因为如果条件为真,它将重定向到标题位置,而不是检查另一个条件…啊,我看到了,这意味着他的退出是无用的,如果我将来需要1,2和3,因为它将在1&2@filledat是的,它需要在那个里格式化数据和会话,并阻止对脚本其余部分的任何恶意请求。请在你说什么之前,在你改变主意之前,最好的答案是什么,不要听初学者的意见,最好去php网站,了解更多关于header()和exit()的信息来自专家。http://php.net/manual/en/function.header.php
http://stackoverflow.com/questions/2747791/why-i-have-to-call-exit-after-redirection-through-headerlocation-in-php
http://stackoverflow.com/questions/8665985/php-utilizing-exit-or-die-after-headerlocation