First PHP examples.
Interleaving PHP and HTML
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
A page to test PHP input
Author: Elena Machkasova elenam@morris.umn.edu
Last modified: 2/7/06
-->
<html>
<head>
<title>
<?php print "First PHP example\n";?>
</title>
</head>
<body>
<h1>
<?php "First PHP example\n";?>
</h1>
Today we start learning PHP.
</body>
</html>
http://rynite.morris.umn.edu/~elenam/1101_fall06/php_examples/first/first.php
Using a variable
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
A page to test PHP input
Author: Elena Machkasova elenam@morris.umn.edu
Last modified: 2/7/06
-->
<?php
$pagename = "Second PHP example\n";
?>
<html>
<head>
<title>
<?php print $pagename;?>
</title>
</head>
<body>
<h1>
<?php print $pagename;?>
</h1>
Today we start learning PHP.
</body>
</html>
http://rynite.morris.umn.edu/~elenam/1101_fall06/php_examples/first/second.php
Using more variables
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
A page to test PHP input
Author: Elena Machkasova elenam@morris.umn.edu
Last modified: 2/7/06
-->
<?php
$pagename = "Another PHP example";
$username = "Joe";
$the_color = "#006400";
?>
<html>
<head>
<title>
<?php print $pagename?>
</title>
</head>
<body>
<h1>
<?php print $pagename;?>
</h1>
<p>
<? print $username?>, welcome to this page!
</p>
<p style="font-weight: bold; color: <? print $the_color?>">
Isn't it really cool?
</p>
</body>
</html>
http://rynite.morris.umn.edu/~elenam/1101_fall06/php_examples/first/third.php
Setting properties of a list
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
A page to test PHP input
Author: Elena Machkasova elenam@morris.umn.edu
Last modified: 2/7/06
-->
<?php
$num_style="upper-roman";
$start_number=3;
?>
<html>
<head>
<title>
PHP list numbering example
</title>
</head>
<body>
<ol style="list-style-type: <? print $num_style ?>" start="<? print $start_number?>">
<li>List element</li>
<li>Another list element</li>
<li>And another one</li>
<ol>
</body>
</html>
http://rynite.morris.umn.edu/~elenam/1101_fall06/php_examples/first/onemore.php