Page 1 of 1

Two scripts in one?

Posted: Thu Jul 01, 2004 9:39 am
by primate
I've got script that outputs results as a list of hyperlinks containing a variable which points to another script that opens in a new window when you click one of the links.

I'm trying to get both scripts to effectively run in the same window without losing the results of the first script and also have the results of the second script appear in a <div> somewhere on the page, so I go through the results on the first page and keep getting the second set of results refreshed on the same page.

The problem is when I come to click the hyperlink now I've put both scripts together I just go back to the original starting form for the first script as if all my variables have vanished.

Do I need to be using session variables for everything or something?

If so is there a straight forward way of turning all the variables in the $_POST superglobal to $_SESSION?

Posted: Thu Jul 01, 2004 10:16 am
by scorphus
Simply:

Code: Select all

<?php
//...
$_SESSION['_POST'] = $_POST;
//...
?>
Follow this example: http://scorphus.no-ip.com/lab/session/

On page4.php the $_POST is copied to $_SESSION. You can view the sources by clicking the .phps files.

-- Scorphus

Posted: Tue Jul 13, 2004 7:28 am
by primate
Duh, thanks, I've got a step further now but run into another problem which I've just posted about :oops: