阅读背景:

一旦出现错误,数据将从输入字段中丢失

来源:互联网 
<html>

    <head>
        <title> Register Page </title>
    </head>
    <body>
        <?php
            session_start();
            $fnameerr = "";
            $lnameerr = "";
            $passworderr = "";
            $emailerr = "";
            $usererr = "";
            $passmatcherr = "";

            if(isset($_POST['submit'])){
                if(empty($_POST['fname'])){
                    $fnameerr = "* Please Enter The First Name";
                }

                if(empty($_POST['lname'])){
                    $lnameerr = "* Please Enter The Last Name";
                }

                if(empty($_POST['username'])){
                    $usererr = "* Please Enter The UserName";
                }

                if(empty($_POST['password'])){
                    $passworderr = "* Please Enter The UserName";
                }

                if($_POST['password'] != $_POST['repassword']){
                    $passmatcherr = "* Password do not match";
                }

                if(empty($_POST['email'])){
                    $emailerr = "* Please Enter the Email Id ";
                }

            }
        ?>
            <h1>Please Fill In The Details</h1><hr>
            <form action="" method=POST >
            <lable> First Name : </lable> <input type=text name = fname placeholder=First Name /><?php echo $fnameerr ?><br><br>
            <lable> Last Name : </lable> <input type=text name = lname  placeholder = Last Name /><?php echo $lnameerr ?><br><br>
            <lable> Username : </lable> <input type=text name = username placeholder=Username /><?php echo $usererr ?><br><br>
            <lable> Password : </lable> <input type=password name = password placeholder=Password /><?php echo $passworderr ?><br><br>
            <lable> Re Password : </lable> <input type=password name = repassword placeholder='Re Password' /><?php echo $passmatcherr ?><br><br>
            <lable> E-Mail Id : </lable> <input type=text name = email [email protected] /><?php echo $emailerr ?><br><br>
            <lable> Area of Intrest : </lable> <select name=subject >
                                                <option value=maths > Maths </option>
                                                <option value=social > Social </option>
                                                <option value=english > English </option>
                                                <option value=science > Science </option>
                                                </select> <br><br>
            <lable> Want To Be A Instructor </lable> <input type=checkbox /> <br><br>
            <input type = submit name = submit value = Register />
            </form>
    </body>
</html>
<html>

    <head>
        <title> Register Pag



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: