Page 1 of 1

values/parameters between php scripts ?

Posted: Thu Nov 13, 2003 10:49 am
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

Posted: Thu Nov 13, 2003 11:09 am
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.