
正文
是用文本框显示数据php 文本框所显示的内容是它的什么属性的值
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
php文本框内显示数据库里面的数据问题
input name="username" type="text" value="?=$row['username']?"
$username=$_POST['username'];
update("update `table` set `username`='$username' where `id`='$id'");
这样就可以了。。。
相关问答
Q1: php中下拉列表选择后,如何在另一个文本框中显示出与选择项匹配的数据库中的值?
?php
$query="select * from test where 1";
$query1=mysql_query($query) or die(mysql_error());
if(mysql_num_rows($query1) 0){
$row = mysql_fetch_row($query1);
@mysql_free_result($query1);
?
html
script
function areas_change(th){
//alert(document.getElementById('areas_str').value);
if(2==th){
//alert(document.getElementById('city').value);
document.getElementById('area').value=document.getElementById('city').value;
}
else if(1==th)
document.getElementById('area').value=document.getElementById('pro').value;
else
document.getElementById('area').value=document.getElementById('county').value;
}
/script
body
select name="areas" id="areas" onchange=" areas_change(this.value);"
option value="3" selected="selected"请选择/option
option value="?php echo $row[0];?"县级/option
option value="2"市级/option
option value="1"省级/option
/select
input type="hidden" readonly name="city" id="city" value='123'
input type="hidden" name="pro" id="pro" value='123'
input type="hidden" name="county" id="county" value='213'
input type="text" maxlength='18' name="area" id="area" value='132' onafterpaste="this.value=this.value.replace(/\'/g,'')"
/body
/html
如何获得下拉列表的值是用文本框显示数据php,只需要$_POST['areas']; 这个例子是php和html代码混合的例子是用文本框显示数据php,是事先提取数据库的值放到select的value中,然后change后用于post提交。
当然你可以用ajax进行异步调用
Q2: 用PHP在数据后循环输出文本框
思路是用文本框显示数据php:
1、构建form表单是用文本框显示数据php,输出文本框是用文本框显示数据php,用textarea/textarea吧,input/内不能换行,页面效果也不好(php、html代码嵌套写是用文本框显示数据php的话,直接写就行,建议用smarty,php与模板分离,比较清晰)
2、提交内容,确定用什么method(post、get)
3、获取内容,$str=$_POST['name'](name为textarea的name值)
4、$arr=split ('\r\n', $str);按换行符分割字符串为数组
5、循环执行插入语句,$arr每一层都是一条数据
Q3: php 文本框显示数据库中的内容,然后修改
笨方法:
用JS获取文本框里的值,然后根据这个值获取oid号,提交的时候一起发送给更新处理程序
是用文本框显示数据php的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于文本框所显示的内容是它的什么属性的值、是用文本框显示数据php的信息别忘了在本站进行查找喔。








