I'm passing a variable to another page in a url using sessions like this but it seems that I can't concatenate another variable to the same url and retrieve it in the next page successfully
Page 1
session_start();
$event_id = $_SESSION['event_id'];
echo $event_id;
$url = "http://localhost/main.php?email=" . $email_address . $event_id;
if (isset($_GET['event_id'])) {
$event_id = $_GET['event_id'];}
echo $event_id;
echo $event_id
Undefined variable
event_id
$url
$url = "http://localhost/main.php?event_id=" . $event_id;
Use the ampersand &
to glue variables together:
$url = "http://localhost/main.php?email=$email_address&event_id=$event_id";
// ^ start of vars ^next var