Can't set session variable based on form value
This is in PHP. I want to set the session variable based on a form value once the form is submitted.
This is the code:
if (!session_id()) session_start();
$_SESSION["sessCustomer"] = "".((isset($_POST["select"]))?$_POST["select"]:"") ."";
On the next page, I'm trying to call the session variable and output it on the page, but it's always blank:
<?php echo $_SESSION['sessCustomer']; ?>
Am I taking the wrong approach?