小编spy*_*ter的帖子

PHP foreach循环与复选框

嗨,我在表单中有许多复选框

<p>Select the modules you take:<br/>
Business <input type="checkbox" name="modules" value="Business"/><br />
Accounting <input type="checkbox" name="modules" value="Accounting"/><br />
Marketing <input type="checkbox" name="modules" value="Marketing" /><br />
</p>
Run Code Online (Sandbox Code Playgroud)

我有一个响应页面,期望用户选择多个答案,那么我将如何使用foreach循环?我尝试过以下但没有希望

foreach($modules as $selected){
print "The modules were ".$modules;
}
Run Code Online (Sandbox Code Playgroud)

提前致谢

php foreach loops

0
推荐指数
1
解决办法
2016
查看次数

标签 统计

foreach ×1

loops ×1

php ×1