php检测表单数据 php查询数据

php 表单怎么验证提交的数据

input name=wd type=text id=kw size=42 style="height:26px" maxlength=100

创新互联主营佳木斯网站建设的网络公司,主营网站建设方案,app软件开发,佳木斯h5微信小程序开发搭建,佳木斯网站营销推广欢迎佳木斯等地区企业咨询

/p

DIV class=hwr_hidden id=hwr_div onclick=stopClosePen(event)/DIV

p style="text-align: center"

input type=submit onClick="return goto();" value=?php echo $config["name"];? id=su INPUT id=su onClick="return goto();" type=button value=我要推广

/p

/FORM

这是图形代码

需要实现的功能:

输入为空的时候 页面自动刷新一次

或者弹出提示框 “请输入查询名称”

PHP怎么获取表单提交的数据啊?

一、用file_get_contents以get方式获取内容,需要输入内容为:

1、?php

2、$url='';

3、$html=file_get_contents($url);

4、echo$html;

5、?

二、用file_get_contents函数,以post方式获取url,需要输入内容为

1、?php

2、$url='';

3、$data=array('foo'='bar');

4、$data=http_build_query($data);

5、$opts=array(

6、'http'=array(

7、 'method'='POST',

8、 'header'="Content-type:application/x-www-form-urlencoded\r\n".

9、          "Content-Length:".strlen($data)."\r\n",

10、 'content'=$data

11、)

12、);

13、$ctx=stream_context_create($opts);

14、$html=@file_get_contents($url,'',$ctx);

15、?

三、用fopen打开url,以get方式获取内容,需要输入内容为

1、?php

2、$fp=fopen($url,'r');

3、$header=stream_get_meta_data($fp);//获取信息

4、while(!feof($fp)){

5、$result.=fgets($fp,1024);

6、}

7、echo"urlheader:{$header}br":

8、echo"urlbody:$result";

9、fclose($fp);

10、?

四、用fopen打开url,以post方式获取内容,需要输入内容为

1、?php

2、$data=array('foo2'='bar2','foo3'='bar3');

3、$data=http_build_query($data);

4、$opts=array(

5、'http'=array(

6、'method'='POST',

7、'header'="Content-type:application/x-www-form-urlencoded\r\nCookie:cook1=c3;cook2=c4\r\n".

8、"Content-Length:".strlen($data)."\r\n",

9、'content'=$data

10、)

11、);

12、$context=stream_context_create($opts);

13、$html=fopen(';id2=i4','rb',false,$context);

14、$w=fread($html,1024);

15、echo$w;

16、?

五、用fsockopen函数打开url,以get方式获取完整的数据,包括header和body,需要输入内容为

1、?php

2、functionget_url($url,$cookie=false)

3、{

4、$url=parse_url($url);

5、$query=$url[path]."?".$url[query];

6、echo"Query:".$query;

7、$fp=fsockopen($url[host],$url[port]?$url[port]:80,$errno,$errstr,30);

8、if(!$fp){

9、returnfalse;

10、}else{

11、$request="GET$queryHTTP/1.1\r\n";

12、$request.="Host:$url[host]\r\n";

13、$request.="Connection:Close\r\n";

14、if($cookie)$request.="Cookie:  $cookie\n";

15、$request.="\r\n";

16、fwrite($fp,$request);

17、while(!@feof($fp)){

18、$result.=@fgets($fp,1024);

19、}

20、fclose($fp);

21、return$result;

22、}

23、}

24、//获取url的html部分,去掉header

25、functionGetUrlHTML($url,$cookie=false)

26、{

27、$rowdata=get_url($url,$cookie);

28、if($rowdata)

29、{

30、$body=stristr($rowdata,"\r\n\r\n");

31、$body=substr($body,4,strlen($body));

32、return$body;

33、}

34、 returnfalse;

35、}

36、?

参考资料:

php-file_get_contents

php中验证表单中的数据与数据库中的数据?

你这样写不对。你要验证学号 姓名 身份证号。可以写在一个查询语句当中。。

如:SELECT student_no,student_name,student_id FROM student_list WHERE student_no = $student_no AND student_name = $student_name AND student_id = $student_id

然后将这段SQL查询语句赋给一个资源变量。用mysql_fetch_array看能否从中获取结果集,如果能则正确。不能的话,就证明输入的数据有误!!

网站标题:php检测表单数据 php查询数据
转载来于:https://www.cdcxhl.com/article48/docpdep.html

成都网站建设公司_创新互联,为您提供网站制作品牌网站设计网站导航品牌网站制作小程序开发

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都seo排名网站优化