php修改表单数据的方法:首先将code设为【type="hidden"】;然后修改页面默认值的选择,代码为【$db = new MySQLi("localhost","root","root","dbname")】。
php修改表单数据的方法:
1、code那一条在数据库里是主键,不能改,所以要把它设为type="hidden"。也可以用type="text" style="display:none"。也可用readonly属性,但不能用disable属性。(disable是使其不可用,虽然不能修改了,它也不向后面传递信息了。)
2、性别那里用三目运算符写比较简单。
3、修改页面默认值的选择。
4、$db = new MySQLi("localhost","root","root","dbname");在本页中只需写一次,后面插入的php代码中不需要再写。
第一个页面xiugai.php
无标题文档 修改数据
query($sql); $arr = $result->fetch_row(); ?>
第二个页面update.php
query($sql))
{
header("location:main.php");
}
else
{
echo "修改失败!";
}
上一篇:php如何实现创建数组的方法
下一篇:java如何实现多线程