• 每日总结


    学习SQL server数据库以及完成php操作数据库的实验

    <?php
    $servername = "localhost:3306";
    $username = "root";
    $password = "";
    $dbname = "php_lab04";
    global $conn;
    // 创建连接
    $conn = mysqli_connect($servername, $username, $password, $dbname);
    // 检测连接
    if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
    }
    
    $conn->query('set names utf8');
    function getConnection(){
        $servername = "localhost:3306";
        $username = "root";
        $password = "whyjlbcdy2001";
        $dbname = "php_lab04";
        return mysqli_connect($servername, $username, $password, $dbname);
    }
    <html>
    <head>
        <title>添加个人资料</title>
        <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    <body>
    <form name="info" action="ex01b.php" method="post" onsubmit="return check()">
        <h2>添加个人资料</h2>
        <table style=" 50%">
            <tr>
                <th>真实姓名:</th>
                <td><input name="name" type="text"></td>
            </tr>
            <tr>
                <th>性别:</th>
                <td>
                    <input type="radio" name="sex" value="男"><input type="radio" name="sex" value="女"></td>
            </tr>
            <tr>
                <th>兴趣爱好:</th>
                <td><input type="text" name="hobby"></td>
            </tr>
            <tr>
                <th>家庭住址:</th>
                <td>
                    <select name="address">
                        <option value ="密云区">密云区</option>
                        <option value ="延庆区">延庆区</option>
                        <option value="朝阳区">朝阳区</option>
                        <option value="丰台区">丰台区</option>
                        <option value="石景山区">石景山区</option>
                        <option value="海淀区">海淀区</option>
                        <option value="门头沟区">门头沟区</option>
                        <option value="房山区">房山区</option>
                        <option value="通州区">通州区</option>
                        <option value="顺义区">顺义区</option>
                        <option value="昌平区">昌平区</option>
                        <option value="大兴区">大兴区</option>
                        <option value="怀柔区">怀柔区</option>
                        <option value="平谷区">平谷区</option>
                        <option value="东城区">东城区</option>
                        <option value="西城区">西城区</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th>备注:</th>
                <td><textarea name="notes" rows="6" cols="45"></textarea></td>
            </tr>
    
            <tr>
                <td colspan="2">
                    <input type="submit" name="submit" value="提交">
                    <input type="reset" value="重置">
                </td>
            </tr>
        </table>
    </form>
    
    </body>
    <script type="text/javascript">
        function check(){
            if(info.name.value==""||info.name.value==null){
                alert("请输入真实姓名!");
                return false;
            }
            if(info.sex.value==""||info.sex.value==null){
                alert("请选择性别!");
                return false;
            }
            if(info.hobby.value==""||info.hobby.value==null){
                alert("请填写兴趣爱好!");
                return false;
            }
            if(info.address.value==""||info.address.value==null){
                alert("请选择地址!");
                return false;
            }
            if(info.notes.value==""||nfo.notes.value==null){
                alert("请填写备注!");
                return false;
            }
        }
    </script>
    </html>
  • 相关阅读:
    redis配置文件参数说明及命令操作
    在Window 下安装Redis数据库
    eclipse怎样在线安装hibernate tools插件并使用
    eclipse如何优化构建的速度(Building)
    java实现敏感词过滤(DFA算法)
    eclipse编码格式设置
    Jquery Ajax简单封装(集中错误、请求loading处理)
    Vue简单封装axios—解决post请求后端接收不到参数问题
    vue项目实现记住密码功能
    vue路由的两种模式配置以及history模式下面后端如何配置
  • 原文地址:https://www.cnblogs.com/Arisf/p/14863769.html
Copyright © 2020-2023  润新知