Jump to content

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.