yeah im making this script that is basically a poll and then the administrator can add, edit, and delete questions. Right now i'm just getting the pages to work and such. Only, the session_register($logged_in_user) doesnt remember that variable when it gets to ?page=1 or any page for that matter. Code is below, help would be much appreciated.

<? session_start(); ?>
<? require_once('config.php'); ?>

<title>poll control panel</title>

<body bgcolor="#FFFFFF">
<h2>Control Panel</h2>
<table border='0' width='500' height='300' bgcolor='#C0C0C0'>
<tr align='center' valign='top'><td>



if ($logged_in_user==$admin_poll){
if ($page==1){
echo "this is the add question page!";
echo "not logged in";
if ($page==logout){
echo "you are now logged out.";
echo "<br><br><a href='cpanel.php'>"."Login"."</a>";
echo "<br><a href='poll.php'>"."Go to poll"."</a>";

else if ($username && $password){
if ($username!=$admin_poll && $password!=$pass_poll){
echo "<font color='#ff0000'>"."invalid username or password"."<br></font color>";
if ($username==$admin_poll && $password==$pass_poll){
echo "welcome, ".$logged_in_user."<br><br>";

<form method=get action='cpanel.php'>
please specify an action: 
<select name='page'>
<option value='1'>add question</option>
<option value='2'>edit question</option>
<option value='3'>delete question</option>
<option value='4'>clear poll</option>
<input type='submit' value='submit'>


}else if($username || $password){
echo "<font color='#ff0000'>"."please fill in all fields"."<br></font color>";


<form method=post action=cpanel.php>
<input type="text" name="username" size=20>
<input type="password" name="password" size=20>
<input type="submit" value="login">


I think it is little problem. Please use following instructions and try once more. It would be work fine.

//First step assign session values to session variable.

$logged_in_user = $username;

//Second step register session varibale as below.


//Please go to next page and use

echo $_SESSION["logged_in_user"];

//It should be work.

This article has been dead for over six months. Start a new discussion instead.