Php HTML does not need to submit a new form. phphtml submits the form.
We usually use ajax to implement the process of refreshing new forms. Some time ago, I learned from the boss that another method of refreshing new forms is implemented using the iframe framework. Now let's sort it out and share it with you.
First:
Html page
<! Doctype html>
PHP page: form. php
<? Php // if (empty ($ _ POST ['uname']) | empty ($ _ POST ['pwd']) {echo '<script type = "text/javascript"> alert ("the user name or password is blank! "); </Script> '; exit;} // verify the password if ($ _ POST ['uname']! = 'Jack' | $ _ POST ['pwd']! = '000000') {echo '<script type = "text/javascript"> alert ("incorrect user name or password! "); </Script> '; exit;} else {echo' <script type =" text/javascript "> alert (" Logon successful! "); </Script> '; exit ;}
Second:
Html page
<! Doctype html>
PHP page: form. php
<? Php // set the time zone date_default_timezone_set ('prc');/* returned submission message status: status msg: prompt message */$ msg = array ('status' => 0, 'msg '=> ''); // obtain the submitted data $ name = $ _ POST ['username']; $ pwd =$ _ POST ['userpwd']; // simulate logon verification $ user = array (); $ user ['name'] = 'jack'; $ user ['pwd'] = 'jack2014 '; if ($ name! = $ User ['name']) {$ msg ['msg '] =' This user is not registered! '; $ Str = json_encode ($ msg); echo $ str; exit;} else if ($ pwd! = $ User ['pwd']) {$ msg ['msg '] = 'incorrect password! '; $ Str = json_encode ($ msg); echo $ str; exit;} $ msg ['msg'] = 'login successful! '; $ Msg ['status'] = 1; $ str = json_encode ($ msg); echo $ str;
The above is all the content of this article. I hope it will help you learn php programming.
Articles you may be interested in:
- Php method for handling multiple submit submission forms
- Php judges the difference between if ($ _ POST [submit]) and if (isset ($ _ POST [submit]) when submitting a form.
- Code Used in PHP to restrict access to IP segments and prohibit IP address submission forms
- PHP prevents cross-origin submission of forms
- How to retain the entered information after a PHP form submission failure
- Php method to prevent remote form submission outside the site
- ThinkPHP automatically escapes when submitting a form
- Php + html5 use FormData object to submit a form and upload an image
- Php Method for submitting a form to send an email
- Php prevents users from submitting forms repeatedly