我在使用php发布复选框时遇到问题。我已经从所有教程中尝试了几种方法,但没有任何作用。
HTML
<label for="Ifyescheckone">Sealed?</label>
<ul>
<li><input class="icheckbox" type="checkbox" name="Ifyescheckone[]" id="Ifyescheckone1" value="Protect">
<label for="Ifyescheckone1" class="ilabel">Protect</label></li>
<li><input class="icheckbox" type="checkbox" name="Ifyescheckone[]" id="Ifyescheckone2" value="Return of">
<label for="Ifyescheckone2" class="ilabel">Return of</label></li>
<li><input class="icheckbox" type="checkbox" name="Ifyescheckone[]" id="Ifyescheckone3" value="Protect against">
<label for="Ifyescheckone3" class="ilabel">Protect against</label></li>
<li><input class="icheckbox" type="checkbox" name="Ifyescheckone[]" id="Ifyescheckone4" value="May indicate"><label for="Ifyescheckone4" class="ilabel">May indicate</label></li>
PHP
<?php echo $_POST["Ifyescheckone"]; ?>
<?php echo $_POST["Ifyescheckone" $value]; ?>
答案 0 :(得分:1)
试试这个,选择一行中的值,
echo $checkbox = implode(", ", $_POST["Ifyescheckone"]);
OR
<?php foreach($_POST["Ifyescheckone"] as $value){
echo $value;
echo " <br/> ";
}
?>