Php HTML does not need to submit a new form. phphtml submits the form.

Source: Internet
Author: User
Tags learn php programming php form

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.