PHP中如何获取文本框的值?
有$_GET 或者 $_POST
创新互联公司主要从事做网站、成都网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务资中,十余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18980820575
代码如下 :
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怎么获取文本框的内容
把文本框放在表单form里面提交就可以了。直接获得文本框的值,要插入多条记录,就用循环执行你的那条数据sql语句咯
think php 后台如何获取 文本框里面的值?
第一种 表单提交
第二种 ajax 要用你input框的id和select框的id
script
//地址添加提交
$(function () {
$('#address_submit').click(function () {
layer.load(1,{time:1000});
var select_country=$('#select_country option:selected').text();//select框
var select_province=$('#select_province option:selected').text();
var select_city=$('#select_city option:selected').text();
var consignee=$('#consignee').val();
var phone=$('#phone').val();
var address_detail=$('#address_detail').val();
if(!select_country || !select_province || !consignee || !phone || !address_detail){
layer.msg('Please complete the receipt information', {icon: 2,offset: '100px',time:'1200'});
}
$.post("{:U('User/addAddress')}",{
'select_country':select_country,
'select_province':select_province,
'select_city':select_city,
'consignee':consignee,
'phone':phone,
'address_detail':address_detail,
},function (data) {
if(data=='success'){
layer.msg('operation success', {icon: 1,offset: '100px',time:'1000'});
setTimeout("window.location.reload()",1000);
}
else{
if (data == 'no_session') {
layer.msg('Login information has failed please log in again ', {icon: 2, offset: '100px', time: '1000'});
setTimeout("location.href = '{:U("index/Login/login")}'", 1000);
return false;
}
layer.msg(JSON.stringify(data), {icon: 2,offset: '100px',time:'1500'});
return false;
}
},'json');
});
})
/script
文章名称:php获得文本框数据 php输出文本框内容
链接URL:http://scgulin.cn/article/doghsse.html