Practical application experience of PHP4 (2)

Source: Internet
Author: User
The other half-login. php script file is opened. If not, the script will accept the input name, check whether the user exists, and decide whether to allow or deny access to the site. Since you haven't learned the conditional statements and logic processing of PHP, we don't want to explain it to you now-on the contrary, we just want to give you SyntaxHighlighter. all (); now I will reveal the other half of the confusion-"login. php "script file. If not, the script will accept the input name, check whether the user exists, and decide whether to allow or deny access to the site. Since you have not learned the conditional statements and logic processing of PHP, we are not going to explain it to you now-on the contrary, we only show you how the data submitted in the preceding form is transferred to "login. php ", and can be used by this file.


This is "login. php"

--------------------------------------------------------------------------------
<Html>
<Head>
<Basefont face = "">
</Head>

<Body>
<Center>
<Font face = "" size = "-1">
I want to know if you have heard of Shakespeare, <? Echo $ name;?>.
<P>
He asked for a bunch of roses named by another name, because the bouquet may smell more fragrant.
<P>
What do you think?
</Font>
</Center>
</Body>

</Html>
--------------------------------------------------------------------------------
When you input data in the form, for example ("zhang san") and submit the data, you will see the following page:

--------------------------------------------------------------------------------
I want to know if you have heard of Shakespeare, James.

He asked for a bunch of roses named by another name, which could smell more fragrant.

What do you think?
--------------------------------------------------------------------------------
You will see that whenever a form is submitted to a PHP script, the variable values and form names in all forms are transmitted to the script in pairs, this can be called by the script at will. In the preceding 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 the variable.

If you use Perl to do the same thing, you need to clearly write the Perl code to get the variable values in the form. By automatically creating and assigning values, PHP simplifies your code and greatly improves development speed-form processing is one of the two reasons why PHP is better than Perl.

Obviously, PHP also supports the form submission post method. all you need to do is to mark the METHOD value as "POST ".

Of course, the example you just saw is very basic. For a really heavyweight program, you need to know how to organize conditional statements. A very basic condition statement is a comparison statement-for example, "if a condition is equal to a condition, use a certain method to perform this action"

PHP has a specially designed operator to facilitate use in conditional statements. Here is a list:

Assume that $ delta = 12 and $ omega = 9

Operator
Meaning
Expression
Result

=
Equal
$ Delta = $ omega
False

! =
Not equal
$ Delta! = $ Omega
True

>
Greater
$ Delta> $ omega
True

<
Less
$ Delta <$ omega
False

> =
Greater than or equal
$ Delta> = $ omega
True

<=
Less than or equal
$ Delta <= $ omega
False


PHP4 also adds a new operator "=" to test whether the two data values and types are the same. there is a simple example in the last section of this section.



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.