Page 1 of 1

Need some help

Posted: Thu Jul 20, 2006 6:25 pm
by paultfh
What I'm trying to do is after the file is created in the following script, I want to open another page and pass it a few variables. I don't know how to do that.

if($_SERVER['REQUEST_METHOD'] == 'POST') {

if(isset($_REQUEST['getfile']) && count($_SESSION['binary']) > 0) {
$str = $fileclass->genfile($_SESSION['binary']);

$newfile = "/files/myfile.nnn";
$fh = fopen($newfile, 'w') or die("Can't open file");
fwrite($fh, $str);
fclose($fh);

exit;
}
}

Posted: Thu Jul 20, 2006 6:30 pm
by RobertGonzalez
You are either going to have to set session vars and use them in both pages, set cookies and use them in the second page or pass them in the query string and use $_GET. On a side note I would recommend staying away from the $_REQUEST global. If you know it is a POST var, use $_POST. If it is a query string var, use $_GET.

Posted: Thu Jul 20, 2006 6:34 pm
by paultfh
How do I pass them in the query string and use $_GET?

Posted: Thu Jul 20, 2006 6:41 pm
by RobertGonzalez

Code: Select all

echo '<a href="/somepage.php?var1=' . $var1 . '&var2=' . $var2 . '">Click this link to go to the next page</a>';

Posted: Thu Jul 20, 2006 6:56 pm
by paultfh
Thanks for your help. That's what I was looking for.