jah35564 Posted September 30, 2007 Share Posted September 30, 2007 I am a Information Technology and I am currently taking PHP as one of my classes. My problem now is that when I create a page and try to view it with Apache, it shows up as a blank page. Please someone help me. Quote Link to comment https://forums.phpfreaks.com/topic/71261-blank-pages-show-up-with-completed-code/ Share on other sites More sharing options...
Daniel0 Posted September 30, 2007 Share Posted September 30, 2007 Perhaps there was some (fatal) error and PHP is configured not to display errors. Quote Link to comment https://forums.phpfreaks.com/topic/71261-blank-pages-show-up-with-completed-code/#findComment-358427 Share on other sites More sharing options...
jah35564 Posted September 30, 2007 Author Share Posted September 30, 2007 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> Quote Link to comment https://forums.phpfreaks.com/topic/71261-blank-pages-show-up-with-completed-code/#findComment-358431 Share on other sites More sharing options...
wildteen88 Posted September 30, 2007 Share Posted September 30, 2007 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> Quote Link to comment https://forums.phpfreaks.com/topic/71261-blank-pages-show-up-with-completed-code/#findComment-358445 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.