oalvarado Posted February 3, 2010 Share Posted February 3, 2010 Hello all, I just started a class on MySQL and PHP. Im running Windows 7 pro and Expression Web 2 as an editor, I'm also using filezilla as FTP to acces my school's server. The issue: I work out my text book for my assigment; simply copy the code and summit, we use the server to check our work. When I upload a php file and try check my work i get a blank page, if I upload an HTML or XHTML file I'm able to see the web page with no problems. Here is a simple script out of the book which I get a blank page: [php <!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"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>variables</title> </head> <body> <?php // Script 2.3 - variables.php // An address: $street = "100 Main Street"; $city = "State College"; $state = "PA"; $zip = 16801; // Print the address. print "<p>The address is:<br />$street<br />$city $state $zip</P> </body> </html> ] [/code] Can Someone please help me out ? By the way I've tried different editors and I keep getting the same problems. Quote Link to comment https://forums.phpfreaks.com/topic/190770-php-newbie-help-please/ Share on other sites More sharing options...
jl5501 Posted February 3, 2010 Share Posted February 3, 2010 print "<p>The address is:<br />$street<br />$city $state $zip</P> should be print "<p>The address is:<br />$street<br />$city $state $zip</P>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/190770-php-newbie-help-please/#findComment-1006003 Share on other sites More sharing options...
oalvarado Posted February 3, 2010 Author Share Posted February 3, 2010 Thanks for the help. I just tried it the way you wrote the last line of the code, I still get the blank page. print "<p>The address is:<br />$street<br />$city $state $zip</P>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/190770-php-newbie-help-please/#findComment-1006199 Share on other sites More sharing options...
KevinM1 Posted February 3, 2010 Share Posted February 3, 2010 Try using the following: <!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"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>variables</title> </head> <body> <?php // Script 2.3 - variables.php // An address: $street = "100 Main Street"; $city = "State College"; $state = "PA"; $zip = 16801; // Print the address. print "<p>The address is:<br />$street<br />$city $state $zip</p>"; ?> </body> </html> You forgot to end your PHP code island (note how the color of this code changes from black and white (html) to colored (PHP)). Quote Link to comment https://forums.phpfreaks.com/topic/190770-php-newbie-help-please/#findComment-1006203 Share on other sites More sharing options...
oalvarado Posted February 3, 2010 Author Share Posted February 3, 2010 ok I fixe'd it but no joy, same problem. I tried adding another ? to the following line: <?php? // Script 2.3 - variables.php my script changed color to red and blue and I was able to get a page on the browser to display address, street, city and zip but not the variables I needed. Quote Link to comment https://forums.phpfreaks.com/topic/190770-php-newbie-help-please/#findComment-1006214 Share on other sites More sharing options...
importune Posted February 3, 2010 Share Posted February 3, 2010 ok I fixe'd it but no joy, same problem. I tried adding another ? to the following line: <?php? // Script 2.3 - variables.php my script changed color to red and blue and I was able to get a page on the browser to display address, street, city and zip but not the variables I needed. Nah, there is only supposed to be one ? in the opening of the php script. He means that after all the php you have to tell the page your done with php and to just go back to html, by using a "?>". Try this : <!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"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>variables</title> </head> <body> <?php // Script 2.3 - variables.php // An address: $street = "100 Main Street"; $city = "State College"; $state = "PA"; $zip = 16801; // Print the address. print "<p>The address is:<br />$street<br />$city $state $zip</p>"; ?> </body> </html> I just tried it out and it works fine like this. Hope you understand the changes. I also had to add the end quote sign and the semicolon at the end of the last print command. Quote Link to comment https://forums.phpfreaks.com/topic/190770-php-newbie-help-please/#findComment-1006221 Share on other sites More sharing options...
oalvarado Posted February 3, 2010 Author Share Posted February 3, 2010 Thanks guys, I keep getting a blank page from the server, I think my problem is at the other end ( server) cause I've tried different editors in the past hour and I keep getting the same result. I've tried Notepad++, Alleycode and MS Expression Web 2 all with the same result, a blank page. Quote Link to comment https://forums.phpfreaks.com/topic/190770-php-newbie-help-please/#findComment-1006230 Share on other sites More sharing options...
oalvarado Posted February 3, 2010 Author Share Posted February 3, 2010 I tried Impotune's code, I get the same blank page <!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"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>variables</title> </head> <body> <?php // Script 2.3 - variables.php // An address: $street = "100 Main Street"; $city = "State College"; $state = "PA"; $zip = 16801; // Print the address. print "<p>The address is:<br />$street<br />$city $state $zip</p>"; ?> </body> </html> I dont know what else to do Quote Link to comment https://forums.phpfreaks.com/topic/190770-php-newbie-help-please/#findComment-1006235 Share on other sites More sharing options...
importune Posted February 3, 2010 Share Posted February 3, 2010 I tried Impotune's code, I get the same blank page <!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"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>variables</title> </head> <body> <?php // Script 2.3 - variables.php // An address: $street = "100 Main Street"; $city = "State College"; $state = "PA"; $zip = 16801; // Print the address. print "<p>The address is:<br />$street<br />$city $state $zip</p>"; ?> </body> </html> I dont know what else to do Well, just to verify I copied that exact code again into a new file, saved it as "add.php", and then put it on my server and it opens beautifully. Perhaps you should try installing php to your computer, and then opening it from your localhost. An easy way to do that would be to use WAMP to install everything. Otherwise, you could just show it to your professor and tell him/her that its giving you a blank page. He'll give you credit for that script, if thats what your worried about. It works. Quote Link to comment https://forums.phpfreaks.com/topic/190770-php-newbie-help-please/#findComment-1006242 Share on other sites More sharing options...
oalvarado Posted February 3, 2010 Author Share Posted February 3, 2010 Thank you Importune and all of you that helpe'd out. I'll install wammp and show it to the professor. Thanks again guys. Quote Link to comment https://forums.phpfreaks.com/topic/190770-php-newbie-help-please/#findComment-1006245 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.