Need some help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
paultfh
Forum Commoner
Posts: 31
Joined: Thu Jul 20, 2006 6:24 pm

Need some help

Post 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;
}
}
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
paultfh
Forum Commoner
Posts: 31
Joined: Thu Jul 20, 2006 6:24 pm

Post by paultfh »

How do I pass them in the query string and use $_GET?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Code: Select all

echo '<a href="/somepage.php?var1=' . $var1 . '&var2=' . $var2 . '">Click this link to go to the next page</a>';
paultfh
Forum Commoner
Posts: 31
Joined: Thu Jul 20, 2006 6:24 pm

Post by paultfh »

Thanks for your help. That's what I was looking for.
Post Reply