I am trying to learn PHP, and I decided that I would do myself a simple exercise to create a site that, if someone goes to it, will receive "Hello, friend!" . but if my wife (called Dawn) comes up to her, she gets another message.
Unfortunately, it always appears as empty, and I'm not sure why.
I know that it works for index.html with text only, and I know that it works for index.php if there is no tag in it <?php(only text works). But when I try to make it an actual php, it just fails.
- I would like to
site/index.php
"Hello friend!" - I would like to
site/index.php?who=Bob
"Hello friend!" - I would like to say
site/index.php?who=Dawn
"Hello, dawn! I love you!"
Here is what I have:
<?php
print 'Hello ';
$who = $_GET("who");
if($who && $who == "Dawn")
print "Dawn! I love you!";
else
print "friend!";
/>
So what's wrong?
source
share