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');?>