Jump to content

Session value failed to retrieve from another page .


tayhaithian

Recommended Posts


<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; ?>

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.