Home  >  Article  >  Backend Development  >  php 表单提交

php 表单提交

WBOY
WBOYOriginal
2016-06-23 13:15:51783browse

 <form id ="btnform"action="login.php" method="post">        一:        <input type="radio" name="name" value="10"> 10        <input type="radio" name="name" value="20"> 20        <input type="radio" name="name" value="30"> 30        <br/>        二:        <input type="radio" name="name2"  value="100"> 100        <input type="radio" name="name2"  value="200"> 200        <input type="radio" name="name2"  value="300"> 300        <br/>        三:        <input type="text" name="name3">        <br/>        </form>


如图表单提交后输出post
Array
(
    [name] => 20
    [name3] => 
)
为什么Array里没 name2 ?
//如果没有我就让它的值为空(如下),但是会报错,说没有name2$list['name2']=isset($_POST['name2'])?$_POST['name2']:"";


回复讨论(解决方案)

没有被选中的的单选钮和复选框是不会被提交的

没有被选中的的单选钮的值是不会被提交的

没有被选中的的单选钮不会提交,所以没有name2 。但是你用isset检查应该不会报错的啊。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn