Jump to content

Recommended Posts

First off,

Today is the first day that I've ever touched PHP. Because of this
our professor gave us an easy assignment. Unfortunately, this easy
assignment is drivin' me insane.

I don't understand why this doesn't work!
Why do I not get any output to the screen when I try to open this page?
I have this document posted on a server. If I'm not mistaking, the PHP
should 'create' the HTML code and thus show the simple statement:

"Welcome to my home page"

Here is my code:

[code]
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//w3c//DTD XHTML 1.1 //EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns = "http://www.w3.org/1999/xhtml">
      <head>
            <title>Simple Welcome</title>
      </head>
      <body>
<?php
    print "Welcome to my home page <br />";
?>
      </body>
</html>

[/code]
Link to comment
https://forums.phpfreaks.com/topic/25980-this-should-be-really-simple/
Share on other sites

realjumper,

I thought the code looked good.
I Just didn't know if I was missing something with the syntax or not.

This is weird that I am getting a blank screen on the server that the file is on
on campus. Where as all of the professor's example files are working fine.

Any other thoughts?
I am still waiting to hear back from the professor about why this isn't working
on the class's server.

Thanks for your help nevertheless.
Create a new PHP file and call it "info.php". Throw the following code in there and then call it form your browser:

[code]<?php

  phpinfo();

?>[/code]

Then come back and let us know if all is well. Also...a blank page leads me to believe there is an error in your page. Check the info page and check the value for "display_errors".
[quote author=JustinK101 link=topic=113652.msg462052#msg462052 date=1162508788]
My guess the extensions (.php, .php3) are not registered with apache and therefore not invoking the php engine.
[/quote]

But if I'm not mistaken, if the php extension isn't registered with apache, then the code in the php file will be displayed to the browser instead of running the code and sending it's results to the browswer.
realjumper

that worked.

the only thing that i can think of is that it doesn't like the xhtml headings..

[code]
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//w3c//DTD XHTML 1.1 //EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
[/code]

That's the only difference between our codes.
Any ideas why the heading I was trying to use wasn't working?



Using this....

[code]
<?xml version="1.0" encoding="ISO-8859-1"?>
[/code]

is the default for an xml document. I suspect the 2 question marks are causing the problem on your server.

This is what I usually use for a php file....

[code]
<!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">
[/code]

Try removing your first line.....
[code]
<?xml version = "1.0" encoding = "utf-8"?>
[/code]
....and see what happens :)
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.