Two scripts in one?

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
primate
Forum Commoner
Posts: 49
Joined: Fri Jun 18, 2004 4:38 am
Location: England, UK

Two scripts in one?

Post 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?
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post 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
primate
Forum Commoner
Posts: 49
Joined: Fri Jun 18, 2004 4:38 am
Location: England, UK

Post by primate »

Duh, thanks, I've got a step further now but run into another problem which I've just posted about :oops:
Post Reply