当前位置:Gxlcms > 数据库问题 > 数据库编辑操作

数据库编辑操作

时间:2021-07-01 10:21:17 帮助过:2人阅读

/*edit.php*/
<?php
include_once"connect.php";

if($_GET[‘ud‘])
{
    $ud=$_GET[‘ud‘];

    $sql="select * from stu where stu_id=$ud";

    $re=mysql_query($sql) or die(mysql_error());

    if(!mysql_num_rows($re))
    {
        echo "ID wrong";
    }
     $row=mysql_fetch_array($re);
    
}

?>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf8" />
    <title>编辑</title>
</head>
    <center>
        <body>
            <form name="from1" action=‘deal_edit.php?ud=<?php echo $_GET["ud"];?>‘  method="post">
                <table border="1" width="30%">
                    <tr>
                        <td colspan="2" align="center">学生信息修改</td>
                    </tr>
                    <tr>
                        <td align="center">编号</td>
                        <td><input name="id" type="text" id="id" value="<?php echo $row[‘stu_id‘]?>" ></td>
                    </tr>
                    <tr>
                        <td align="center">姓名</td>
                        <td><input name="name" type="text" id="name" value="<?php echo $row[‘stu_name‘]?>"></td>
                    </tr>
                    <tr>
                        <td align="center">性别</td>
                        <td>
                            <input type="radio"  name="sex" value="男" checked=‘checked‘  value="<?php echo $row[‘stu_sex‘]?>">男
                            <input type="radio"  name="sex" value="女">女
                        </td>
                    </tr>
                    <tr>
                        <td align="center">年龄</td>
                        <td>
                            <select name="age" id="age">
                                <?php
                                for($i=10;$i<30;$i++)
                                {
                                ?>
                                    <option value="<?php echo $i?>"><?php echo $i?>岁</option>
                                <?php
                                }
                                ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center"><input name="Submit" type="submit" value="保存">
                        <a href=‘sy.php‘><input name="return" type="button" value="返回" ></a></td>
                    </tr>
                </table>    
            </form>
        </body>
    </center>
</html>

 

数据库编辑操作

标签:

人气教程排行