Jump to content

Blank pages show up with completed code


jah35564

Recommended Posts

This is the code that I use:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 strict//EN""http://www.W3.org/TR/xhtmll/DTD/xhtmll1_strict.dtd''> <htrnl>

<head>

<title>Hello World</title>

</head>

<body>

 

 

<?php

/* 

define ("WORLD_iNFO", = ",92897000);

define ("SUN_INFO") = 72000000;

define ("MOON_INFO") = 3456;

$WorldInfo = 92897000;

$SunInfo = 72000000;

$MoonInfo = 3456;

*/

<p>

echo "<p>Hello", $WorldVar!" <br />" 

echo "The $WorldVar is", WORLD_INFO," miles from the $SunVar.<br />";

echo "Hello ", $SunVar, "!<br />";

echo "The $SunVar's core temperature is approximately", SUN_INFO," degrees Fahrenheit.<br />";

echo "Hello ", $MoonVar, "!<br />";

echo "The $MoonVar is MOON_INFO," miles in diameter.</p>";

</p>

?>

</body>

</html>

Well that code has many HTML and and PHP syntax errors. You cannot place html code within php tags. All html must be placed within an echo statement. You are not concatenating strings properly either. Define is used incorrectly and you are using variables which don't exist, due to them being spelled incorrectly.

 

Your DOCTYPE isn't closed properly due to using incorrect quotes.

 

Corrected code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 strict//EN" "http://www.W3.org/TR/xhtmll/DTD/xhtmll1_strict.dtd">
<html>
<head>
<title>Hello World</title>
</head>
<body>
<?php
define ("WORLD_INFO",92897000);
define ("SUN_INFO", 72000000);
define ("MOON_INFO", 3456);
$WorldInfo = 92897000;
$SunInfo = 72000000;
$MoonInfo = 3456;

echo "<p>Hello", $WorldInfo."!<br />
";
echo "The $WorldInfo is", WORLD_INFO," miles from the $SunInfo.
";
echo "Hello ", $SunInfo, "!
";
echo "The $SunInfo's core temperature is approximately", SUN_INFO," degrees Fahrenheit.
";
echo "Hello ", $MoonInfo, "!
";
echo "The $MoonInfo is MOON_INFO, miles in diameter.</p>";
?>
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.