File: deal. php
<? Php
Echo "your username is: $ uname ";
?> The above program requires the user to enter a user name, submit the form, and then return to the user name to confirm the information. It can be seen that the uname in the form has become the $ uname variable in the deal. php program. Simple. :-)
Let's take a look at the basic process control of PHP:
If... Else... Elseif
Syntax 1:
If (condition ){
Statement body
}
Syntax 2:
If (condition ){
Statement body 1
} Else {
Statement Body 2
}
Syntax 3:
If (condition 1 ){
Statement body 1
} Elseif (condition 2 ){
Statement Body 2
} Else {
Statement body 3
}
We changed the above deal. php program:
<? Php
If ($ uname = "James "){
Echo "nice to see you, James. ";
} Elseif ($ uname = "Xiaohua "){
Echo "oh, it's Xiaohua. ";
} Else {
Echo "you are $ uname, right ";
}
?>
In addition to the if statement, there is a while loop. Its syntax is as follows:
While (condition ){
Statement body
}
When the condition is true, the execution statement body.
Do... The while syntax is as follows:
Do {
Statement body
} While (condition)
Execute the statement body once. If the condition is true, execute the statement body again in a loop.
The syntax of the for Loop is the same as that of C, as shown below:
For (initial condition; judgment condition; condition change) {statement}
The break jumps out of the executing loop, and the continue interrupts this loop.
Okay. Here is the article. I believe you will soon be able to get started with the above basics.