PDA

View Full Version : PHP Problem



lamer
09-24-2006, 11:41 AM
Hi...
I just began studying PHP and immediately ran into problems. I can't get my site to respond properly to the code presented below. I'm trying to get the code to generate different page for different names when correcting the URL (example http://mysite.com/test.php?name=Jack). (If the name is Jack, I want it to display "Hello Jack".) Instead of displaying hello Jack when I correct the URL, it displays the else value :(
Code:


<?php
if($name==Jack)
echo "Hello, Jack";
else
echo "You're not Jack";
?>

Thank you in advance.

areidmtm
09-24-2006, 11:56 AM
use this



<?php
if ($_GET['name'] == 'Jack') {
echo "Hello, Jack";
}
else {
echo "You're not Jack";
}
?>

lamer
09-24-2006, 01:41 PM
Thank you, mate, you rule! Respect ;)