values/parameters between php scripts ?

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
vertigo
Forum Newbie
Posts: 5
Joined: Thu Nov 13, 2003 10:49 am

values/parameters between php scripts ?

Post by vertigo »

Hello
On my page i use header() function to go to other php pages.
Example: page1.php
.....some code.....header("location: http://mypage/page2.php\r\n");
but i would like to call page2.php with 'some parameters' so i could
show page2.php and fill some data according to page1.php values.
Is it possible ? How can i do it ?

Thanx
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

Call page2.php using a query string:

Code: Select all

header("location: http://mypage/page2.php?userId=234&product=65\r\n");
and on page2.php use the$_GET predefined var:

Code: Select all

echo $_GET['userId'] . '<br />';
echo $_GET['product'] . '<br />';
Take a look to [php_man]variables.predefined[/php_man] ($_GET)

Hope that helps,
Scorphus.
Post Reply