How do IF to redirect to a new page on my site?
How do IF to redirect to a new page on my site?
am 22.02.2008 21:56:36 von Greg Cocks
Hello,
I have a page 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]=20
...
}
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>"
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)
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=3D"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=3D"javascript:document.forms[0].reset();"
in the 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
Re: How do IF to redirect to a new page on my site?
am 22.02.2008 22:00:04 von germana
--=-pPpPLaxdHYk64bCl5lB7
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
try changing print for echo or header
On Fri, 2008-02-22 at 13:56 -0700, Greg Cocks wrote:
> Hello,
>
> I have a page 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>"
> 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)
> 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 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
>
--=-pPpPLaxdHYk64bCl5lB7--
RE: How do IF to redirect to a new page on my site?
am 22.02.2008 22:01:00 von Bill Bolte
http://us.php.net/header=20
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
will generate an error.
Bill
-----Original Message-----
From: Greg Cocks [mailto:gcocks@stoller.com]=20
Sent: Friday, February 22, 2008 2:57 PM
To: php-windows@lists.php.net
Subject: [PHP-WIN] How do IF to redirect to a new page on my site?
Hello,
I have a page 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]=20
...
}
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>"
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)
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=3D"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=3D"javascript:document.forms[0].reset();"
in the 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
--=20
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