Home >Backend Development >PHP Tutorial >Live Football 8 International Version Download PHP4 Practical Application Experience Chapter 5

Live Football 8 International Version Download PHP4 Practical Application Experience Chapter 5

WBOY
WBOYOriginal
2016-07-29 08:33:53939browse

Author: Sun Movement
PHP also provides you with a way to handle multiple possibilities - the "if-elseif-else" structure. A typical "if-elseif-else" structural statement will look like this:
-------------------------------- ---------------------------------------------
if (The first condition is correct)
{
do this!
}
elseif (The second condition is correct)
{
do this!
}
elseif (The third condition is correct)
{
do this!
}
...wait...
else
{
do this!
}
---------------------------------- --------------------------------------------------
Here's an example of how to use it:
------------------------------------------------ ----------------------------------------
< html>
< head>
< style type="text/css">
td {font-family: Arial;}
< /style>
< /head>
< body>
< font face="Arial" size ="+2">
Amazing fortune cookie production program
< /font>
< form method="GET" action="cookie.php">
< table cellspacing="5" cellpadding="5" border="0">
< tr>
< td align="center">
Please select a date
< /td>
< td align="right">
< select name="day">
< option value="Monday">Monday
< option value="Tuesday">Tuesday
< option value="Wednesday">Wednesday
< option value="Thursday">Thursday
< option value="Friday">Friday
< option value="Saturday">Saturday
< option value="Sunday">Sunday
< /select>
< /td>
< /tr>
< tr>
< tr>
< td colspan="2" align="center">
< input type="submit" value=" Click me!">
< /td>
< /tr>
< /table>
< /form>
< /body>
< /html>
------ -------------------------------------------------- -----------------------
 You will see that this simple form allows you to select a day of the week. The actual processing is done by the submitted PHP script "cookie.php".
------------------------------------------------- -------------------------------
< ?
if ($day == "Monday")
{
$ fortune = "Don't make everything simple and effective when you can find a way to make it complicated and wonderful.";
}
elseif ($day == "Tuesday")
{
$fortune = "Life is a game Bridge? - You must have some kind of trick up your sleeve. ";
}
elseif ($day == "Wednesday")
{
$fortune = "What can keep a sane person from going crazy in this world? ";
}
elseif ($day == "Thursday")
{
$fortune = "Don't be crazy, be fun";
}
elseif ($day == "Friday")
{
$fortune = "Just Follow the times, go with the trend, and when you get promoted, you will find that type is a devil. ";
}
else
{
$fortune = "Sorry, closed on weekends";
}
?>
< html>
< head>
< basefont face="Arial">
< /head>
< body>
This is your lucky word for < ? echo $day; ?>:
< br>
< b>< ? echo $fortune; ?>< /b>
< /body>
< /html>
-------------------------- -------------------------------------------------- ---------------
 In this case, we use control sentences to assign different lucky words to each day.
There is an important point to note here - when an "if" statement in the structure is found to be true, PHP will execute the corresponding code, ignore the remaining "if" statements in the structure, and immediately jump out of the "if" -elseif-else" structure, execute the lines following the entire structure.​

The above has introduced PHP 8 international version download PHP4 practical application experience part 5, including the content of live football 8 international version download, I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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