Passing data in $_Session vars
Posted on 2013-11-12
I have a page (BuildingChk.php) that is used by several other pages. Depending on the page that it came from, it passes data in $_SESSION['Data'].
The page I'm having trouble with needs to add 2 variables to session variable. I'm building the session variable like so:
$_SESSION['Data'] = $ROW2['SEQ'].$ROW2['NOR'].$ROW2['SOU'];
This does work.
My problem is the length of "NOR" and "SOU". They could be any where from 1 to 4 chars.
Is there a way to set them to 4 chars before building the string?
Also, the following code comes from the page that get's the results.
I've modified the code so that it is only looking for 2 chars in north and south (quick fix).
$strt = substr($_SESSION['Data'],0,9);
$work = $strt."%";
$north = substr($_SESSION['Data'],12,13);
$south = substr($_SESSION['Data'],14,15);
The results that I'm getting from the "echo" statements are as follows:
Everything is correct except for the $north. Why is it returning 4 chars instead of 2?