• JAVA日报


    php(ex02b.php)

    <?php
    if(isset($_GET['name'])&&isset($_GET['sex'])){
    $ID = $_GET['name'];
    $sex = $_GET['sex'];
    }
    if(isset($_POST['name'])&&isset($_POST['sex'])&&isset($_POST['hobby'])&&isset($_POST['area'])&&isset($_POST['ect'])){
    $ID = $_POST['name'];
    $sex = $_POST['sex'];
    $hobby = $_POST['hobby'];
    $area = $_POST['area'];
    $ect = $_POST['ect'];
    echo $_GET['act'].'++++';
    $conn=mysqli_connect("localhost","root","123","text3") or die("数据库连接失败");
    mysqli_query($conn,'set names utf8');

    $sql2="insert into student (id,sex,hobby,area,ect) VALUES ('$ID','$sex','$hobby','$area','$ect')";

    if ($conn->query($sql2) === TRUE) {
    } else {
    echo "Error: " . $sql2. "<br>" . $conn->error;
    }

    $conn->close();
    }
    ?>
    <h1><?php if($sex=='女'){echo $ID.'女士';}else{echo $ID.'先生';}?>,您好,对不起,没有找到您的个人资料请填写您的详细信息!</h1>
    <div style="position: absolute;height: 60%; 70%;left: 20%;top: 15%">
    <form action="ex02b.php" method="post">
    <table border="1" style="height: 100%; 100%">
    <tr>
    <td style="text-align: center" colspan="3">
    学生个人信息
    </td>

    </tr>
    <tr>
    <td>您的姓名:</td>
    <td colspan="2"><input name="name" type="text"></td>
    </tr>
    <tr>
    <td>性别:</td>
    <td><input type="radio" name="sex" value="男">男<input type="radio" name="sex" value="女">女</td>
    </tr>
    <tr>
    <td>年龄:</td>
    <td colspan="2"><input name="hobby" type="text"></td>
    </tr>
    <tr>
    <td>家庭住址:</td>
    <td colspan="2">
    <input name="area" type="text">
    </td>
    </tr>
    <tr>
    <td>
    特长爱好:
    </td>
    <td colspan="2">
    <input name="hobby" type="text">
    </td>
    </tr>
    <tr>
    <td colspan="3" style="text-align: center">
    <input type="submit" value="提交">&nbsp<a href="ex02a.php">返回首页</a>
    </td>
    </tr>
    </table>
    </form>
    </div>
  • 相关阅读:
    如何编译Linux内核
    svn
    windows live writer …
    SVN服务器配置
    使用PowerDesigner创建数据库表图文并茂版
    maven学习
    在PreparedStatement中设置空值
    今天, 我的博客正式开通啦.
    Neo4j简介
    clinit和init(转载)
  • 原文地址:https://www.cnblogs.com/mumulailai/p/14912409.html
Copyright © 2020-2023  润新知