How to write a simple PHP print error message line?
Let us write a simple PHP code to print an error message with showing different types of comments that you can have. Save your file as checkerror.php and then upload the script to your server to be tested.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitionl.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Welcome to the iSelfSchooling PHP example page!</title>
</head>
<body>
<?php
// Print an error message.
print (“Your code has an ERROR MESSAGE”);
/*
Print an error message with changing a text color
*/
print “Your code has an <font color=\”#E8D1A2”><big>ERROR MESSAGE</big></font>”;
<!-- Print an error message with a white space or blank line. -->
print “<p>Your code has an <font color=\”brown”><big>ERROR MESSAGE</big></font></p>\n”;
?>
</body>
</html>
|