$_SESSION variables are not working on second page

Viewed 26

I have created a session at my first page:

<?php 
  $youtubeID = get_sub_field('youtube_id'); 
  $withlastSlash = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  $withoutSlash =  substr_replace($withlastSlash, "", -1);
  $howtoURL = $withoutSlash . "?a=" . $youtubeID;
  session_start();
  $_SESSION['howtovidsurl'] = $howtoURL;
?> 

I have then called the session variables in my second page

<?php
    session_start(); 
    echo $_SESSION['howtovidsurl']; 
?> 

But nothing is getting echoed out on the second page.

0 Answers
Related