• 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>";
    }
    ?>
  • 相关阅读:
    Red5/FMS视频直播带宽计算
    基于NPOI开源框架写的ExcelHelper
    Using C# 4.0 and dynamic to parse JSON
    跟我学MVVM模式开发
    supermap使用代码示例(GIS)
    使用OpenXML将Excel内容读取到DataTable中
    ADO 数据类型转换表
    I don't like Regex...
    将Datatable转Excel少于4笔时汉字乱码4/26
    记录宝宝成长脚印3/31
  • 原文地址:https://www.cnblogs.com/SirNie/p/14909689.html
Copyright © 2020-2023  润新知