As a result of discussion on my previous question:
Passing data to another page after form submit with PHP
I've discovered my syntax is correct but not working the way I need it.
I'm trying to pass a variable from my first page (my page with a form) to my second page (basically just a splash to say they submitted the form).
The variable is a unique ID used as a reference number for the submission. I get the unique ID by generating a random sequence in a function.
My problem is such: I can get my variable to pass across the two pages with this code
//(First Page)
$result = "TEST";
header('Location: submittedApplication.php?result='. $result);
and I grab it with this code
//(Second Page)
echo $_GET['result'];
Which works and passes a variable for me. But what I need is to utilize this function:
function gen_uid($l=10)
{
$prefix = "#####";
$str = "";
date_default_timezone_set('America/New_York');
$date = date("Y.m.d");
for ($x=0;$x<$l;$x++)
$str .= substr(str_shuffle("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 1);
echo $prefix . $str . "<br/>" . "Generated On: " . $date;
}
What I would like to use is
$result = gen_uid();
But it just passes empty to the second page, even though when I echo it out to test on the first page it works and gives me data like this
######NMB32R3MVQ
Generated On: 2017.04.27
As a recap; Page 1 is: form.php, Page 2 is: submittedApplication.php, I'm trying to pass $result (while holding the string my function generates) from page 1 -> page 2. I'm new to web development so I'm open to any avenue of getting this to work, I'm just not able to determine what avenue that is.