Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php中使用GET检索复选框选定值_Php_Checkbox - Fatal编程技术网

如何在php中使用GET检索复选框选定值

如何在php中使用GET检索复选框选定值,php,checkbox,Php,Checkbox,我正在使用Mysql PDO查询获取所需的结果,它保存在数组$newfamily中。现在,在这个数组的帮助下,我用给定的代码实现了复选框- <form method="get" action="specific_family.php"> <?php foreach($newfamily as $name) { ?> <input type='checkbox'<?php echo $name;?>"

我正在使用Mysql PDO查询获取所需的结果,它保存在数组$newfamily中。现在,在这个数组的帮助下,我用给定的代码实现了复选框-

<form method="get" action="specific_family.php">
  <?php
    foreach($newfamily as $name)
            {
  ?>
        <input type='checkbox'<?php echo $name;?>"><?php echo $name;?></input>
 <?php
            } 
 ?>
 </select> <input type = "submit" name="submit" >
 </form>


如果将name属性添加到输入中,则:

 <form method="get" action="specific_family.php">
  <?php
    foreach($newfamily as $name)
            {
  ?>
                <label for="<?php echo $name?>"><?php echo $name?></label>
                <input type='checkbox' name="<?php echo $name;?>" id="<?php echo $name;?>"></input>
 <?php
            } 
 ?>
 </select> <input type = "submit" name="submit" >
 </form>

然后,您的复选框将按名称显示在$\u GET数组中


希望有帮助:)

如果您将name属性添加到输入中,则:

 <form method="get" action="specific_family.php">
  <?php
    foreach($newfamily as $name)
            {
  ?>
                <label for="<?php echo $name?>"><?php echo $name?></label>
                <input type='checkbox' name="<?php echo $name;?>" id="<?php echo $name;?>"></input>
 <?php
            } 
 ?>
 </select> <input type = "submit" name="submit" >
 </form>

然后,您的复选框将按名称显示在$\u GET数组中


希望有帮助:)

如果您将name属性添加到输入中,则:

 <form method="get" action="specific_family.php">
  <?php
    foreach($newfamily as $name)
            {
  ?>
                <label for="<?php echo $name?>"><?php echo $name?></label>
                <input type='checkbox' name="<?php echo $name;?>" id="<?php echo $name;?>"></input>
 <?php
            } 
 ?>
 </select> <input type = "submit" name="submit" >
 </form>

然后,您的复选框将按名称显示在$\u GET数组中


希望有帮助:)

如果您将name属性添加到输入中,则:

 <form method="get" action="specific_family.php">
  <?php
    foreach($newfamily as $name)
            {
  ?>
                <label for="<?php echo $name?>"><?php echo $name?></label>
                <input type='checkbox' name="<?php echo $name;?>" id="<?php echo $name;?>"></input>
 <?php
            } 
 ?>
 </select> <input type = "submit" name="submit" >
 </form>

然后,您的复选框将按名称显示在$\u GET数组中


希望有帮助:)

复选框应该有:

  • 标签
复选框需要:

  • 名称属性
  • 值属性
它不能有:

  • 结束标记(除非您使用的是XHTML)
因此:



该复选框应具有:

  • 标签
复选框需要:

  • 名称属性
  • 值属性
它不能有:

  • 结束标记(除非您使用的是XHTML)
因此:



该复选框应具有:

  • 标签
复选框需要:

  • 名称属性
  • 值属性
它不能有:

  • 结束标记(除非您使用的是XHTML)
因此:



该复选框应具有:

  • 标签
复选框需要:

  • 名称属性
  • 值属性
它不能有:

  • 结束标记(除非您使用的是XHTML)
因此:



我尝试了这个方法,但这样我看不到复选框名称:(对不起,我没有插入任何类型的标签。请参阅edit.casewarecomputers.com:8088/test.phpI尝试了这个方法,但这样我看不到复选框名称:(抱歉,我未能插入任何类型的标签。请参阅edit.casewarecomputers.com:8088/test.phpI尝试了此操作,但这样我看不到复选框名称:(抱歉,我未能插入任何类型的标签。请参阅edit.casewarecomputers.com:8088/test.phpI尝试了此操作,但这样我看不到复选框名称:(很抱歉,我没有插入任何类型的标签。请参阅edit.casewarecomputers.com:8088/test.php