Php basic tutorial-2 create a template and process a form

Source: Internet
Author: User
Php basic tutorial-2 create a template and process Form 1. create a template:

Copy the frequently-seen part of the page to an html or php file, and introduce it using the require ()/include () function in the original page.

Example:

SOURCE html:

   
  test  

This is the foot of the document


Copied header: header.html:

   
  test  

Copy tail: footer.html:

This is the foot of the document


Merging Template: ws. php

 
 


II. process the form ?? Allows a page to display and process forms simultaneously

Conditional statement:

If (form submission) {processing form}

Else {display form}


Example: Simple user name-password verification


Enter: user name: YF password: 123456

Display: Login successful

Cut chart:




Code: ws.php (header.html?footer.html references the template above ):

  logged in !

';}else {print '

name or password is worry!

';}}else {print '

make sure you enter both name and password!

';}}else {print '';}require('footer.html');?>

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.