By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,216 Members | 1,032 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,216 IT Pros & Developers. It's quick & easy.

How do I get IE to redirect to a new page on my site in an IF statement?

P: 53

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

Expand|Select|Wrap|Line Numbers
  1. if(isset($ary_query_result))    {
  2.                       ...
  3.                       serialize array to text file
  4.                       few other tasks
  5.                       ['jump' to results page]
  6.                     ...
  7.                     }
  8.                     else
  9.                     {
  10.                       ...
  11.                       tell user to adjust parameters
  12.                       [stay on page] 
  13.                       ...
  14.                     }
I have built a results page that unserializes the searliized results array, 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] in Internet Explorer ^6& 7????

This would seem such a simple thing to do...

i.e., IF (condition) go to new url ELSE stay at this url


I tried:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" language="javascript">"foo_query_select.php","_top")</script>
this works OK in Mozilla, funny frame refresh of foo_query.php before it redirects to foo_query_results.php but I can live with that BUT it does not work in IE, just (seemingly) refreshes foo_query_select.php

Expand|Select|Wrap|Line Numbers
  1. <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_query_results.php" on the form, passing the parameters as $_SESSION variables - but what about if no results returned, data flow not as clean IMHO, etc, etc, etc...

And the popup blocker is set 'properly' in IE7

* HELP!!!! *

Thanks in advance... :-)

Feb 26 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 971
Moving to the PHP Forum.

Feb 26 '08 #2

P: 53
OK, it turns out that IE would use the"url") just fine... it was just never getting there in the code!!

here was the problem and the 'fix' if you were curious:



<!-- "BAD" -- does *not* work in IE, but works in FF -->
if(isset($_POST['query_with_parameters'])) //where 'query_with_parameters' is the name of the submit (sic) button on the HTML form
// code to run

<!-- "GOOD" -- works in IE *and* FF -->
<!-- added at the top of the form -->
<form action="<?PHP print $_SERVER['PHP_SELF']; ?>" method="post" name="data_select" onsubmit="return js_fun_check_entry(this);">
<input type="hidden" name="_submit_check" value="1" />
<!-- guts of the form -->
if(array_key_exists('_submit_check', $_POST))
//code to run
Feb 27 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.