Typically, we use AJAX to submit a form without a flush. A while ago, follow the boss to learn another way to submit a form without refreshing. Now let's sort it out and share it with everyone.
The first type:
(HTML page)
<!DOCTYPE HTML><HTMLLang= "en -us"><Head> <MetaCharSet= "Utf-8"> <title>No Refresh Submission Form</title> <styletype= "Text/css">ul{List-style-type:None;} </style></Head><Body> <iframename= "Formsubmit"style= "Display:none;"> </iframe>
<!--the window submitted by the form form points to the hidden Ifrmae and submits the data through Ifrmae. -<formAction= "form.php"Method= "POST"name= "formphp"Target= "Formsubmit"> <ul> <Li> <label for= "Uname">User name:</label> <inputtype= "text"name= "Uname"ID= "Uname" /> </Li> <Li> <label for= "pwd">Password</label> <inputtype= "Password"name= "pwd"ID= "pwd" /> </Li> <Li> <inputtype= "Submit"value= "Login" /> </Li> </ul> </form></Body></HTML>
(PHP page)
<?PHP//non-null validation if(Empty($_post[' uname ']) ||Empty($_post[' pwd '])) { Echo' <script type= ' text/javascript ' >alert ("User name or password is empty!"); </script> '; Exit; } //Verify Password if($_post[' uname ']! = ' Jack ' | |$_post[' pwd ']! = ' 123456 ') { Echo' <script type= ' text/javascript ' >alert ("username or password is incorrect!"); </script> '; Exit; } Else { Echo' <script type= ' text/javascript ' >alert ("Login successful!"); </script> '; Exit; }