Page 1 of 1

Undefined index: in in /home/noob/public_html/admin/main.php

Posted: Mon Jun 05, 2006 7:07 pm
by a94060
Ok,i decided to turn on error checking adn i see this error. what is the asiest way to find out the problem?

Posted: Mon Jun 05, 2006 7:33 pm
by John Cartwright
can you post the exact error message, along with some code please.

Posted: Mon Jun 05, 2006 7:59 pm
by a94060
Array ( )
Notice: Undefined index: in in /home/noob/public_html/admin/main.php on line 15
It says array because i sued print_r for testing sessions(which i cant get to work)

Code: Select all

<?PHP
session_start();
?>
<!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 http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Main Admin Page</title>
</head>

<body>
<?PHP
print_r($_SESSION);
error_reporting(E_ALL);
if($_SESSION['in'] != 'yes') {
echo 'You are not logged in,please go to <a href="http://avi.aerohostale.com/admin">Here</a> to login';
}
else {
echo 'Welcome to the admin page. This is the basic layout so far.<br>Please use one of the links below to do what you would like to.';
echo '<br>';
echo '<br>';
echo '<a href="http://avi.aerohostale.com/admin/addoffer.php">Add An Offer</a>';
echo '<br>';
echo '<a href="http://avi.aerohostale.com/admin/tabview.php">View Pending and Completed Offers</a>';
echo '<br>';
echo '<a href="http://avi.aerohostale.com/admin/pay.php">Make a Payment to Someone</a>';
}
?>
thats the code for the page im accessing.

Posted: Mon Jun 05, 2006 9:09 pm
by John Cartwright
$_SESSION['in'] does not exist yet, so you have to check for it's existence before using it..

Code: Select all

if(isset($_SESSION['in']) && $_SESSION['in'] != 'yes') {

Posted: Tue Jun 06, 2006 5:10 am
by a94060
so,that will be hgow i use it on the next pages?