http://us.php.net/header
header('Location: http://www.example.com/');
Just make sure that nothing is echo/print out to the page before doing
the header call, don't even have any spaces before your <?php tag, or it
will generate an error.
Bill
-----Original Message-----
From: Greg Cocks [mailto:[EMAIL PROTECTED]
Sent: Friday, February 22, 2008 2:57 PM
To: [email protected]
Subject: [PHP-WIN] How do IF to redirect to a new page on my site?
Hello,
I have a page <foo_query_select.php> where some users set some
parameters from pulldowns on a page (in a form.)
Based on the user selection, the code builds some SQL (i.e., building
the WHERE part of the SQL string), and grabs some data out of a
PostgreSQL, and returns it to an array, $ary_query_result
Then:
if(isset($ary_query_result)) {
...
serialize array to text file
few other tasks
['jump' to results page]
...
}
else
{
...
tell user to adjust parameters
[stay on page]
...
}
I have built a results page that unserializes the results array above,
displays some of them in a table, and allows the user to chart, save all
the data columns & rows, etc - all works fine.
HERE IS THE PROBLEM: how do I ['jump' to results page]????
This would seem such a simple thing to do...
i.e., IF (condition) go to new url ELSE stay at this URL
-----
I tried:
(i) print "<script language... windows.location = \"foo_results.php\";
<\script>"
this works OK in Mozilla, funny frame refresh of foo_query.php before it
redirects to foo_results.php but I can live with that BUT it does not
work in IE, just (seemingly) refreshes foo_query.php
(ii) <meta http-equiv="refresh" ... />
Ugly I know (!) - again OK in Mozilla BUT again it does not work in IE,
same result (or lack)
(iii) Googled for more, tried a few, no luck - arghhh!!!
I guess I could create the SQL and get the data on the results page, and
use action="foo_results.php" on the form, passing the parameters as
$_SESSION variables - but what about if no results returned, etc, etc,
etc...
**************
* HELP!!!! *
**************
Thanks in advance... :-)
P.S. When they return to the query page for a new search (in the same
session) from the results page (in Mozilla!), the check box values are
still set - tried using onload="javascript:document.forms[0].reset();"
in the <body> tag and a few other things - no luck, they stay set!! -
any thoughts?
----------
Regards,
GREG COCKS
GIS Analyst V
Gcocks|at|stoller.com
S. M. Stoller Corp
105 Technology Drive, Suite 190
Broomfield, CO 80021
www.stoller.com
303-546-4300
303-443-1408 fax
303-546-4422 direct
303-828-7576 cell
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php