前端:
?
|
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输入框中的值去数据库比较显示出来,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对快网idc网站的支持!
原文链接:http://www.cnblogs.com/yangzailu/archive/2016/11/16/6069282.html
相关文章
猜你喜欢
- ASP.NET自助建站系统的域名绑定与解析教程 2025-06-10
- 个人服务器网站搭建:如何选择合适的服务器提供商? 2025-06-10
- ASP.NET自助建站系统中如何实现多语言支持? 2025-06-10
- 64M VPS建站:如何选择最适合的网站建设平台? 2025-06-10
- ASP.NET本地开发时常见的配置错误及解决方法? 2025-06-10
TA的动态
- 2025-07-10 怎样使用阿里云的安全工具进行服务器漏洞扫描和修复?
- 2025-07-10 怎样使用命令行工具优化Linux云服务器的Ping性能?
- 2025-07-10 怎样使用Xshell连接华为云服务器,实现高效远程管理?
- 2025-07-10 怎样利用云服务器D盘搭建稳定、高效的网站托管环境?
- 2025-07-10 怎样使用阿里云的安全组功能来增强服务器防火墙的安全性?
快网idc优惠网
QQ交流群
您的支持,是我们最大的动力!
热门文章
-
2025-05-27 81
-
2025-05-25 55
-
Spring boot通过HttpSessionListener监听器统计在线人数的实现代码
2025-05-29 35 -
2025-05-25 64
-
2025-05-29 39
热门评论

