呼应多个复选框值在PHP [英] Echoing multiple checkbox values In PHP
本文介绍了呼应多个复选框值在PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 $ _ GET
开关按钮有问题。
I am having trouble using $_GET
with radio buttons.
4th<input type="checkbox" name="date" value="4th">
5th<input type="checkbox" name="date" value="5th">
6th<input type="checkbox" name="date" value="6th">
用户选择他们提供什么日子。然后我想呼应了天用户选择的内容:
The user chooses what days they are available. Then I want to echo out what days the user selected:
<?php echo "You are available " . $_GET["date"] . "!"; ?>
以上code只有回声出来的。并非所有的三种。有没有办法做到这一点?
The above code only echos out one. Not all three. Is there a way to do this?
推荐答案
名称将是一个数组
<input type="checkbox" name="date[]" value="4th" />
<input type="checkbox" name="date[]" value="5th" />
<input type="checkbox" name="date[]" value="6th" />
然后得到的价值是这样
Then get value like this
<?php
echo "You are available ";
foreach($_POST["date"] as $value) {
echo "$value";
}
?>
这篇关于呼应多个复选框值在PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文