Tutorial 2 Php Introduction 1002
Tutorial 2 Php Introduction 1002
Html code can be embedded into Php.
The following will display as bold
<?Php
echo ”<b>hello</b>”;
?>
Let’s try the below example with some cool CSS (Cascading style sheets) formatting
.
We will save the below document as a php document - nice.php and a separate file named nicestyle.css in the webroot folder,.
The following is the complete document - nice.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Control Panel login</title>
<link rel="stylesheet" type="text/css" href="nicestyle.css" />
</head>
<body>
<center>
<div id="bkground1"> <!-- finishes on line 19-->
<p><a href="myfile.php">My Online Auctions</a></p>
<p> <?Php echo "<b>Welcome to my site<b>"; ?> </p>
</div> <!--end bkground1 from line 16-->
</center>
</body>
</html>
The following is the CSS document – nicestyle.css
#bkground1 {
width: 100px;
background: #FFFFCC;
padding: 4px;
border: 1px solid #ccc;
}
P{
font-weight: bold;
}
/* Navigation Links */
a {color:maroon;} a:hover {color:red;} a:visited {color:green;}
Save both the above files in the webroot and run the php file - nice.php to see some nice formatting.
Post a Comment