First example
<?php
$s _html= "<b> text bold it1994.cn</b>";
echo $s _html;
?>
second Case
<?php
$s _javascript=<<<start
<script type= "Text/javascript" >
alert ("it1994.cn");
</script>
start;
echo $s _javascript;
?>
third column
<?php
$a = "name";
$ $a = "Hello php";
echo $name;
?>
Fourth Case
<?php
$color = "";
echo "<ul>";
For ($i =1; $i <=10; $i + +)
{
if ($i%2==0)
{
$color = "Red";
}else
{
$color = "Yellow";
}
echo "<li style= ' background:". $color. "; width:200px ' > ". $i." Line </li></ul> ";
}
?>
Fifth Case
index.php page:
<form action= "check.php" method= "POST" >
User name: <input type= "text" name= "user"/><br/>
Password: <input type= "password" name= "pass"/><br/>
<input type= "Submit" value= "Submission"/>
<input type= " reset" value= "reset"/>
</form>
check.php page:
<?php
if (Isseet ($_post))
{
if ($_post[' name ']== ' admin ' && $_post[' pass ']== ' admin ')
{
echo "User login successful";
}else{
echo "User login failed";
}
}
?>
This article is from the "Zhongze" blog, make sure to keep this source http://8281493.blog.51cto.com/8271493/1622515
PHP Programming Classic 300 cases, 第1-5 example