Home > Backend Development > PHP Tutorial > PHP4 Practical Application Experience Part 2_PHP Tutorial

PHP4 Practical Application Experience Part 2_PHP Tutorial

WBOY
Release: 2016-07-13 17:26:13
Original
818 people have browsed it

Now I will reveal the other half of the mystery to you - the "login.php" script file. If nothing else, this script will accept the entered name, check to see if the user exists, and decide whether to allow or deny access to the site. Since you haven't learned PHP's conditional statements and logic processing, we are not going to demonstrate it for you now - instead, we will just show you how the data submitted in the previous form is sent to "login.php" and can used by this file.
This is "login.php"
---------------------------------------- ---------------------------------------------







I was wondering if you had ever heard of Shakespeare, .

He asked for a bouquet of roses with another name because that bouquet might smell more fragrant.

What do you think?




------------------------ -------------------------------------------------- -------
When you enter data in the form, for example ("Zhang San"), and submit it, you will see the following page:
---------- -------------------------------------------------- --------------------
I wonder if you have heard of Shakespeare, Zhang San
He asked for a bouquet of roses with another name, Just because that bunch might smell a little more fragrant
What do you think?
-------------------------------------------------- ----------------------------------


You will see that whenever the form When submitted to a PHP script, all variable values ​​​​in the form and the name of the form will be sent to the script in pairs, so that they can be called arbitrarily by the script. In the above example, when the form is submitted, the variable $name is automatically created in the script "login.php", and the value entered by the user in the form is also assigned to this variable.
If you were to do the same thing in Perl, you would need to write the Perl code very clearly to get the variable value in the form. By automatically creating and assigning values, PHP simplifies your code and greatly improves development speed - form handling is one of the two reasons why PHP is better than Perl.
Obviously, PHP also supports the POST method of form submission. All you need to do is to mark the value of METHOD as "POST".
Of course, the example you just saw is very basic. For really heavyweight programming, you need to know how to organize conditional statements. A very basic conditional statement is a comparison statement - for example: "If such and such are equal, then do this action in a certain way"
PHP has a series of operators specially designed to facilitate use in conditional statements. Here is a list:
Assume $delta = 12 and $omega = 9
Operator
Meaning
Expression
Result
==
Equals
$delta == $omega
False
!=
not equal to
$delta != $omega
True
>
greater than
$delta > $omega
True
is less than
$delta False
>=
is greater than or equal to
$delta > = $omega
True
Less than or equal to
$delta False
PHP4 also adds a new operator "===", which is used to test whether the two data values ​​and types are the same , there is a simple example in the last subsection of this part.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531990.htmlTechArticleNow I will reveal the other half of the mystery to you - the "login.php" script file. If nothing else, this script will accept the entered name, check whether the user exists, and decide whether to allow or deny access...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template