• 2021.5.25


    ex01b:

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>个人信息</title>
    </head>
    <style>
    tr{
    text-align: center;
    }
    </style>
    <body>
    <table border="1" cellpadding="5" cellspacing="0" ">
    <tr>
    <td colspan="7"><p>学生个人信息表 </p></td>
    </tr>
    <tr>

    <td>姓名</td>
    <td>性别</td>
    <td>爱好</td>
    <td>住址</td>
    <td>备注</td>
    <td colspan="2">操作</td>
    </tr>
    <tr>
    <?php
    include_once('conn.php');

    $sqlstr = "select * from phpstu";
    $result = mysqli_query($conn,$sqlstr);

    while ($rows = mysqli_fetch_row($result)){
    echo "<tr>";
    for($i = 0; $i < count($rows); $i++){
    echo "<td >".$rows[$i]."</td>";
    }
    echo "<td><a href='ex01b_update.php?name={$rows[0]}&sex={$rows[1]}&hobby={$rows[2]}&address={$rows[3]}&beizhu={$rows[4]}'>修改</a>/<a href='ex01b_delete.php?name={$rows[0]}'>删除</a></td>";
    echo "</tr>";
    }

    ?>
    </tr>
    </table>
    </body>
    </html>

    ex001a:
    <?php
    header ( "Content-type: text/html; charset=utf-8" ); //设置文件编码格式
    include_once('conn.php');

    $name=$_POST['name'];
    $sex=$_POST['sex'];
    $hobby=$_POST['hobby'];
    $address=$_POST['address'];
    $beizhu=$_POST['beizhu'];

    $sql = "insert into phpstu(name,sex,hobby,address,beizhu)values('{$name}','{$sex}','{$hobby}','{$address}','{$beizhu}')";
    $result=mysqli_query($conn, $sql);

    if($result){
    echo "<script>alert('添加成功');window.location.href='ex01b.php'</script>" ;
    }else{
    echo "<script>alert('添加失败');history.go(-1);</script>";
    }
    ?>
  • 相关阅读:
    window.clearInterval与window.setInterval的用法
    <a href=“#”>
    DIV+CSS 中的 overflow:hidden
    @media screen
    VS2010程序打包操作--超详细
    Easy CHM使用简明教程
    垃圾纸盒的叠法-超级实用
    IOS 3D UI --- CALayer的transform扩展
    CGContextAddArc
    CGPathAddArc
  • 原文地址:https://www.cnblogs.com/SirNie/p/14909689.html
Copyright © 2020-2023  润新知