tayhaithian Posted January 22, 2009 Share Posted January 22, 2009 <html> <head> </head> <body> <br /><br /><br /> <center><h1> Please choose only the available left Tables . Sorry for any inconvenience . </h1></center> <?php if(isset($_POST['Submit'])) { session_start(); $_SESSION['table_id']=$_GET['table_id']; //print_r ($_SESSION['table_id']); header ('location:special.php'); } include('conn.php'); $data=mysql_query("SELECT table_id FROM restab WHERE NOT EXISTS ( SELECT table_id FROM payments WHERE STATUS='pending' AND restab.table_id = payments.table_id )") or die(mysql_error()); echo '<center>'; echo '<form method="POST" action="table.php">'; echo '<select name="table_id">'; for($i=0;$i<mysql_num_rows($data);$i++) { $row=mysql_fetch_assoc($data); echo '<option value="'.$row['table_id'].'">'.$row['table_id'].'</option>'; } echo '</select>'; echo '<br /><br /><input type="submit" name="Submit" value="GO ==>>"/>'; echo '</form>'; echo '</center>'; ?> </body> </html> retrieve page : <? session_start() ?> <?php $test=$_SESSION['table_id']; echo $test; ?> Quote Link to comment https://forums.phpfreaks.com/topic/141983-session-value-failed-to-retrieve-from-another-page/ Share on other sites More sharing options...
premiso Posted January 22, 2009 Share Posted January 22, 2009 Why are you passing a table_id via get? Should that be post? Quote Link to comment https://forums.phpfreaks.com/topic/141983-session-value-failed-to-retrieve-from-another-page/#findComment-743413 Share on other sites More sharing options...
Philip Posted January 22, 2009 Share Posted January 22, 2009 Change your first script to: <?php session_start(); ?> <html> <head> </head> <body> <br /><br /><br /> <center><h1> Please choose only the available left Tables . Sorry for any inconvenience . </h1></center> <?php if(isset($_POST['Submit'])) { $_SESSION['table_id']=$_GET['table_id']; //print_r ($_SESSION['table_id']); header ('location:special.php'); } include('conn.php'); $data=mysql_query("SELECT table_id FROM restab WHERE NOT EXISTS ( SELECT table_id FROM payments WHERE STATUS='pending' AND restab.table_id = payments.table_id )") or die(mysql_error()); echo '<center>'; echo '<form method="POST" action="table.php">'; echo '<select name="table_id">'; for($i=0;$i<mysql_num_rows($data);$i++) { $row=mysql_fetch_assoc($data); echo '<option value="'.$row['table_id'].'">'.$row['table_id'].'</option>'; } echo '</select>'; echo '<br /><br /><input type="submit" name="Submit" value="GO ==>>"/>'; echo '</form>'; echo '</center>'; ?> </body> </html> I'm honestly surprised you're not getting any errors Quote Link to comment https://forums.phpfreaks.com/topic/141983-session-value-failed-to-retrieve-from-another-page/#findComment-743416 Share on other sites More sharing options...
tayhaithian Posted January 22, 2009 Author Share Posted January 22, 2009 still same error > < '' Notice: Undefined variable: _SESSION in C:\wamp\www\foodsys\header.php on line 28 eric Quote Link to comment https://forums.phpfreaks.com/topic/141983-session-value-failed-to-retrieve-from-another-page/#findComment-743421 Share on other sites More sharing options...
tayhaithian Posted January 22, 2009 Author Share Posted January 22, 2009 Solved !! have to change <?php session_start() ?> instead of <? session_start() ?> sweat .... Quote Link to comment https://forums.phpfreaks.com/topic/141983-session-value-failed-to-retrieve-from-another-page/#findComment-743428 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.