http://www.pgrocer.com/php/begin/
hellovar.php
<html>
<head><title>Hello
with variable</title></head>
<body>
<?php
$varhello =
"Hello World";
echo $varhello;
?>
</body>
</html>
hello.php
<html>
<head>
<title>PHP
Test</title>
</head>
<body>
<?php echo "<h1
align=center>Hello World!</h1>"; ?>
</body>
</html>
hello1.php
head>
<title>PHP
Test</title>
</head>
<body>
<?php
echo "<h1
align=center>Hello World!</h1>";
?>
</body>
</html>
phpinfo.php
<html>
<head><title>Check
information</title></head>
<body>
<?php
phpinfo();
?>
</body>
</html>
helloname.php
<html>
<head><title>Hello
with variable</title></head>
<body>
<?php
$varFirst =
"John"; // assigns John to
$varFirst
$varLast =
"Doe"; // assigns Doe to
$varSecond
echo "Hello
", $varFirst, " ", $varLast;
?>
</body>
</html>
browser.php
<html>
<head><title>Browser</title></head>
<body>
<h1>Tells the
browser</h1>
<?php echo
$_SERVER["HTTP_USER_AGENT"]; ?>
</body>
</html>
whichbrowser.php
<html>
<head><title>Which
browser</title></head>
<body>
<?php
if
(strstr($_SERVER["HTTP_USER_AGENT"], "MSIE"))
{
echo "The browser is Internet
Explorer!<br />";
}
else
{
echo "Are you using Netscape, Opera or
another browser?<br />";
}
?>
</body>
</html>
whichbrowser1.php
<html>
<head><title>Which
browser</title></head>
<body>
<?php
if
(strstr($_SERVER["HTTP_USER_AGENT"], "MSIE"))
{
?>
<h2>The
browser is Internet Explorer</h2>
<?php
}
else
{
?>
<h2>Are you
using Netscape, Opera or another browser?</h2>
<?php
}
?>
</body>
</html>
calc.php
<html>
<head><title>Hello
with variable</title></head>
<body>
<?php
$var1 = 2;
$var2 = 5;
$var3 = 3;
$varAns = 0;
$varAns = $var1 + $var2 * $var3;
echo "The
answer is ", $varAns;
?>
</body>
</html>
passdata.html
<html>
<head><title>Pass
data</title></head>
<body>
<h3>Passing
data through the href</h3>
<a
href="receive.php?school=BCC">Passing that the school is
BCC</a>
</body>
</html>
receive.php
<html>
<head><title>Receive
data from href</title></head>
<body>
<?php
echo "Welcome to, $school!";
?>
</body>
</html>
passdata1.html
<html>
<head><title>Pass
data</title></head>
<body>
<h3>Passing
data through the href</h3>
<a
href="receive1.php?school=BCC">Passing that the school is
BCC</a>
</body>
</html>
receive1.php
<html>
<head><title>Receive
data from href</title></head>
<body>
<?php
echo ("Welcome to, $school!");
?>
</body>
</html>
passdata2.html
<html>
<head><title>Pass
data</title></head>
<body>
<h3>Passing
data through the href</h3>
<a
href="receive2.php?school=BCC">Passing that the school is BCC</a>
</body>
</html>
receive2.php
<html>
<head><title>Receive
data from href</title></head>
<body>
<?php
$school;
echo ("Welcome to, $school!");
?>
</body>
</html>
math.php
<html>
<head><title>Math</title></head>
<body>
<h2>Here are
some math facts!</h2>
<?php
$ct;
$startnum=1;
$endnum=4;
for ($ct=$startnum;
$ct <= $endnum; $ct=$ct + 1)
{
$ans = $ct + $ct;
echo ("$ct + $ct = $ans<br>");
}
?>
</body>
</html>
math1.php
<html>
<head><title>Math</title></head>
<body>
<h2>Here are
some math facts!</h2>
<?php
$ct;
$ct1;
$startnum=1;
$endnum=4;
for ($ct=$startnum;
$ct <= $endnum; $ct=$ct + 1)
{
for ($ct1=$startnum; $ct1 <= $endnum;
$ct1 = $ct1 + 1)
{
$ans = $ct + $ct1;
echo ("$ct + $ct1 = $ans<br>");
}
}
?>
</body>
</html>
mathdowhile.php
<html>
<head><title>Math</title></head>
<body>
<h2>Here are
some math facts!</h2>
<?php
$ct;
$startnum=1;
$endnum=4;
$ct=$startnum;
do
{
$ans = $ct + $ct;
echo ("$ct + $ct =
$ans<br>");
$ct = $ct + 1;
} while ($ct <=
$endnum);
?>
</body>
</html>
mathuntil.php
<html>
<head><title>Math</title></head>
<body>
<h2>Here are
some math facts!</h2>
<?php
$ct;
$startnum=1;
$endnum=4;
$ct=$startnum;
do
{
$ans = $ct + $ct;
echo ("$ct + $ct =
$ans<br>");
$ct = $ct + 1;
} until $ct >=
$endnum;
?>
</body>
</html>
mathwhile.php
<html>
<head><title>Math</title></head>
<body>
<h2>Here are
some math facts!</h2>
<?php
$ct;
$startnum=1;
$endnum=4;
$ct=$startnum;
while ($ct <=
$endnum)
{
$ans = $ct + $ct;
echo ("$ct + $ct = $ans<br>");
$ct = $ct + 1;
}
?>
</body>
</html>
stuformget.html
<html>
<head><title>Hello
with variable</title></head>
<body>
<h3>This is
the form</h3>
<form
action="formuse.php" method="get">
Name: <input
type="text" name="stuname"><br>
Grade: <input
type="text" name="grade"><br><br>
<input
type="submit" value="SUBMIT">
</form>
</body>
</html>
formuse.php
<html>
<head><title>Form
using get</title></head>
<body>
<?php
echo ("<h3>Student Name:
$stuname </h3>");
echo ("<h3>Student Grade:
$grade</h3>");
?>
</body>
</html>
stuformpost.html
<html>
<head><title>Hello
with variable</title></head>
<body>
<h3>This is
the form</h3>
<form
action="formuse.php" method="post">
Name: <input
type="text" name="stuname"><br>
Grade: <input
type="text" name="grade"><br><br>
<input
type="submit" value="SUBMIT">
</form>
</body>
</html>