Undefined index
Posted: Mon May 31, 2004 5:16 am
Hey,
I'm pretty new to php, and having a few problems.
<?php
session_start();
$_SESSION['username']= "Joe123245";
$_SESSION['authuser']= 1;
?>
<html>
<head>
<title>
Find my favourite movie
</title>
</head>
<body>
<?php
$myfavmovie=urlencode("Life of brian");
echo "<a href='http://localhost/moviesite2.php?favmovie=$myfavmovie'>";
echo "Click here to see information about my favorite movie!";
echo "</a>";
?>
</body>
</html>
<?php
session_start();
?>
<html>
<head>
<title>My Movie site - <?php echo $_REQUEST['favmovie']?></title>
</head>
<body>
<?php
echo "Welcome to our site, ";
echo $_SESSION['username'];
echo "<br>";
echo "My favourite movie is ";
echo $_REQUEST['favmovie'];
echo "<br>";
$movierating = 5;
echo "My movie rating for this movie is";
echo $movierating;
?>
</body>
</html>
This should be nice and simple and i swear i had this working last night but now i get
Welcome to our site,
Notice: Undefined index: username in C:\Apache2\WWW\localhost\moviesite2.php on line 11
My favourite movie is Life of brian
My movie rating for this movie is5
I'm kind of guessing i've installed something wrong as the code is pretty damn simple,
cheers
I'm pretty new to php, and having a few problems.
<?php
session_start();
$_SESSION['username']= "Joe123245";
$_SESSION['authuser']= 1;
?>
<html>
<head>
<title>
Find my favourite movie
</title>
</head>
<body>
<?php
$myfavmovie=urlencode("Life of brian");
echo "<a href='http://localhost/moviesite2.php?favmovie=$myfavmovie'>";
echo "Click here to see information about my favorite movie!";
echo "</a>";
?>
</body>
</html>
<?php
session_start();
?>
<html>
<head>
<title>My Movie site - <?php echo $_REQUEST['favmovie']?></title>
</head>
<body>
<?php
echo "Welcome to our site, ";
echo $_SESSION['username'];
echo "<br>";
echo "My favourite movie is ";
echo $_REQUEST['favmovie'];
echo "<br>";
$movierating = 5;
echo "My movie rating for this movie is";
echo $movierating;
?>
</body>
</html>
This should be nice and simple and i swear i had this working last night but now i get
Welcome to our site,
Notice: Undefined index: username in C:\Apache2\WWW\localhost\moviesite2.php on line 11
My favourite movie is Life of brian
My movie rating for this movie is5
I'm kind of guessing i've installed something wrong as the code is pretty damn simple,
cheers