Home  >  Article  >  Backend Development  >  php和html之间的传值问题

php和html之间的传值问题

WBOY
WBOYOriginal
2016-06-23 13:22:352110browse


这样的表单我用form怎么向php传值,重点是php怎么接收这样的数据


回复讨论(解决方案)

 用  Ajax  提交数据

1、可以把输入框的name,用数组

<input type="text" class="input" name="name[]">

2、可以把表单序列化提交
3、还可以用js自己控制

那在php方面该怎么接收呢 求指点 我小白

使用$_POST["name"]接受

method="post" 然后  $_POST['username']接收

form表单里两个参数,一个action,表明了往哪个文件传,不写默认传自己;一个method,表明用什么方式传,有get和post两种
input框加name
接受的文件里用$_POST(post方式)或者$_GET(get方式)接收。最简单的是直接var_dump($_POST)或者var_dump($_GET)然后你就知道怎么调用了

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