Hello everyone...!!!!
I am new to PHP and have problems using $_SESSIONS , the SESSION variables which I set in one file are not recognised in scripts stored in other Files...I get the error :Undefined index 'XYZ' for any arbitrary variable $_SESSION...Anyone having idea to resolve this issue....Following is the code in index file that directs to another file 'processor.php'
<?php
session_start();
//Database Login Information
$_SESSION['host'] = "localhost";
$_SESSION['user'] = "root";
$_SESSION['pass'] = "";
$_SESSION['name'] = "guestbook";
?>
Code for the file in which I use these variables is
<?php
session_start();
$connection = mysql_connect($_SESSION['host'],$_SESSION['user'],$_SESSION['pass'],$_SESSION['name']) or die (mysql_error());
mysql_select_db ($_SESSION['name']) or die(mysql_error());
$query = "INSERT INTO entries (ID, Name, Comment, Email) VALUES (NULL, '{$_POST['name']}', '{$_POST['comment']}', '{$_POST['email']}');";
mysql_query ($query) or die (mysql_error());
mysql_close($connection);
header ("Location: http://localhost/guestbook");
?>
P.S. Any help would be greatly appreciated..:-)