I am trying my hand in PHP and got stuck with the urlencode. Please see the two code
first document@
<HTML>
<HEAD>
<TITLE>My Movie Site</TITLE>
</HEAD>
<BODY>
<?php
// delete as per page 34 define ('FAVMOVIE', 'The life of Brian');
echo 'My favorite movie is ';
echo $_GET['favmovie'];
echo '<br/>';
$movierate = 5;
echo 'My movie rating for this movie is: ';
echo $movierate;
?>
</BODY>
</HTML>
Second document
<HTML>
<HEAD>
<TITLE>Find my Favorite Movie!</TITLE>
</HEAD>
<BODY>
<?php
$myfavmovie = urlencode ('Life of Brian');
echo '<a href = "http://php.aryapratinidhisabha.org.uk?favmovie=$myfavmovie\">' ;
echo 'Click here to see information about my favorite movie!' ;
echo '</a>' ;
?>
</BODY>
</HTML>
I am getting the following result all the time:
In the first line: "My favorite movie is $myfavmovie\"
In the second line: "My movie rating for this movie is: 5"
My questoins are:
- Why am I not getting in the first line: "My favorite movie is Life of Brian"?
- The book says that in the url the result should be "http://php.aryapratinidhisabha.org.uk/?favmovie=$Life+of+Brian instead it gives this http://php.aryapratinidhisabha.org.uk/?favmovie=$myfavmovie. Why is that?
Thanks,
Naveen