I have an issue that I cannot display the selected value using session. Can I check that previously I have a created a dropdown list(Page1.php) and display my selected value on Page2.php using session then on page2.php I have another droplist list as below (page2.php) but I could not display the selected value on page3.php using session. I cant figure where it is wrong.
Page2.php:
<?php session_start(); ?>
<select name="amtoftable" size="1" class="StyleTextField" id="amtoftable" >
<p>
</p>
<?php if($_SESSION['svenue'] == 'Bliss'){ ?>
<option value="-1"> Select no.of tables</option>
<?php $dbtables = $_COOKIE["amtoftable"];
if ($dbtables == "41")
echo "option selected = 'true' value = '41'>41</option?>";
else echo "<option value='41'>41</option>"; ?>
<?php $dbtables = $_COOKIE["amtoftable"];
if ($dbtables == "42")
echo "option selected = 'true' value = '42'>42</option?>";
else echo "<option value='42'>42</option>"; ?>
<?php
if(isset($_POST['SubmitBooking'])){
if($_POST['amtoftable'] == '41')
$stable = '41';
}
else if($_POST['amtoftable'] == '42')
$stable = '42';
}
//save session
$_SESSION["ctables"] = $_POST['amtoftable'];
die("<script>location.href = 'Payment.php'</script>");
}
page3.php
<?php session_start(); ?>
<label for="label-tables">No.of tables: </label>`enter code here`
<?php echo $_SESSION['amtoftable'];?>