Page 1 of 1

Need Help

Posted: Fri Jul 29, 2011 11:30 pm
by michaelli321
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

Re: Need Help

Posted: Sat Jul 30, 2011 12:41 am
by Benjamin
/n should be \n

Good job!

Re: Need Help

Posted: Sat Jul 30, 2011 11:23 am
by michaelli321
Benjamin wrote:/n should be \n

Good job!
how do you do the backwards slash? instead of / cause my keyboard doesn't have that key.

Re: Need Help

Posted: Sat Jul 30, 2011 11:38 am
by califdon
Most keyboards have the backslash key right above the Enter key.

Re: Need Help

Posted: Sat Jul 30, 2011 2:37 pm
by michaelli321
califdon wrote:Most keyboards have the backslash key right above the Enter key.

yea thanks I finally found it