PHP头条
热点:

php获取$_POST同名参数数组


 今天写php的时候发现$_POST["arr"]无法获取参数arr的数组,记录一下。

 例如有以下表单需要提交:

  <input type="checkbox" name="arr" value="" />

  <input type="checkbox" name="arr" value="" />

  <input type="checkbox" name="arr" value="" />

  <input type="checkbox" name="arr" value="" />

 使用$_POST["arr"]只能获得最后选择的复选框的值,要获得全部选中的复选框的值需要把表单修改成下面:

  <input type="checkbox" name="arr[]" value="" />

  <input type="checkbox" name="arr[]" value="" />

  <input type="checkbox" name="arr[]" value="" />

  <input type="checkbox" name="arr[]" value="" />

这样就可以使用$_POST["arr"]获得全部选中的checkbox的值了。

www.phpzy.comtrue/php/4532.htmlTechArticlephp获取$_POST同名参数数组 今天写php的时候发现$_POST["arr"]无法获取参数arr的数组,记录一下。 例如有以下表单需要提交: input type="checkbox" name="arr" value="" / input type="checkbox" name="arr" val...

相关文章

相关频道:

PHP之友评论

今天推荐