Need Help
Posted: Fri Jul 29, 2011 11:30 pm
Right now I'm learning how to code with php and I have never coded with anything in my life before, and I have run into a problem. I am trying to use variables and on the webpage I am testing everything out with looks like this:
You are running the file:
C:\Inetpub\vhosts\tagslash.com\httpdocs\predefined.php.
/n
You are viewing this page using:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
/n
This server is running:
Microsoft-IIS/7.5.
/n
According to my textbook, everything is right except for the /n's. I do not know where they came from but I need to get them away. Here is my code that I put in:
1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2. <html xmlns="http://www.w3.org/1999/xhtml"xml:lang="en" lang="en">
3. <head>
4. <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
5. <title>Predefined Variables</title>
6. </head>
7. <body>
8. <?php # Script 1.5 - predefined.php
9.
10. // Create a shorthand version of the variable names:
11. $file = $_SERVER['SCRIPT_FILENAME'];
12. $user = $_SERVER['HTTP_USER_AGENT'];
13. $server = $_SERVER['SERVER_SOFTWARE'];
14.
15. // Print the name of this script:
16. echo "<p>You are running the file:<br /><b>$file</b>.</p>/n";
17.
18. // Print the user's infromation:
19. echo "<p>You are viewing this page using: <br /><b>$user</b></p>/n";
20.
21. // Print the server's information:
22. echo "<p>This server is running:<br /><b>$server</b>.</p>/n";
23.
24. ?>
25. </body>
26. </html>
thanks
You are running the file:
C:\Inetpub\vhosts\tagslash.com\httpdocs\predefined.php.
/n
You are viewing this page using:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
/n
This server is running:
Microsoft-IIS/7.5.
/n
According to my textbook, everything is right except for the /n's. I do not know where they came from but I need to get them away. Here is my code that I put in:
1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2. <html xmlns="http://www.w3.org/1999/xhtml"xml:lang="en" lang="en">
3. <head>
4. <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
5. <title>Predefined Variables</title>
6. </head>
7. <body>
8. <?php # Script 1.5 - predefined.php
9.
10. // Create a shorthand version of the variable names:
11. $file = $_SERVER['SCRIPT_FILENAME'];
12. $user = $_SERVER['HTTP_USER_AGENT'];
13. $server = $_SERVER['SERVER_SOFTWARE'];
14.
15. // Print the name of this script:
16. echo "<p>You are running the file:<br /><b>$file</b>.</p>/n";
17.
18. // Print the user's infromation:
19. echo "<p>You are viewing this page using: <br /><b>$user</b></p>/n";
20.
21. // Print the server's information:
22. echo "<p>This server is running:<br /><b>$server</b>.</p>/n";
23.
24. ?>
25. </body>
26. </html>
thanks