gpt4 book ai didi

PHP获取input输入框中的值去数据库比较显示出来

转载 作者:qq735679552 更新时间:2022-09-27 22:32:09 25 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章PHP获取input输入框中的值去数据库比较显示出来由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

前端:

?
1
2
3
<!--商品查询-->
<input type= "text" name= "bianhao" value= "" maxlength= "10" size= "10" style= "width:100px; margin:0px 0px 0px 25px;height:20px;" />
<input type= "submit" value= "商品编号查询" style= "margin:0px 0px 0px 10px;cursor:pointer;background-color:#C30D23;border:0px;color:#FFFFFF;width:85px;border-radius:5px;padding:3px 0;font-size:13px;" />

php后台接收并查询:

?
1
2
3
4
5
6
7
8
9
public function MallList(){ //写方法
$goods =M( 'shop_goods_info' ); //实例化数据库对应的表
$codes =I( 'param.bianhao' ); //获取前台文本框数据
if (isset( $codes ) && $codes != '' ){
$where [ 'code' ]= $codes ;
$this ->assign( 'codes' , $codes ); //显示
}
}
$info = $classify ->where( array ( 'code' => $code ))->find(); //查询语法

2.或者:

有$_GET 或者 $_POST 。

?
1
2
3
4
5
6
7
8
9
<form action= '' method= 'post' >
文本框:<input type= 'text' name= 'text' >
<input type= 'submit' value= '提交' ,name= 'sub' >
</form>
<?php
if (! empty ( $_POST [ 'sub' ])){
echo $_POST [ 'text' ];
}
?>

如果是GET 就换成GET 。

以上所述是小编给大家介绍的PHP获取input输入框中的值去数据库比较显示出来,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我网站的支持! 。

原文链接:http://www.cnblogs.com/yangzailu/archive/2016/11/16/6069282.html 。

最后此篇关于PHP获取input输入框中的值去数据库比较显示出来的文章就讲到这里了,如果你想了解更多关于PHP获取input输入框中的值去数据库比较显示出来的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com