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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scubak1w1
    New Member
    • Feb 2008
    • 53

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

    Hello,

    I have a page <foo_query_sele ct.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_resu lt

    Then:
    Code:
    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 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:

    (i)
    Code:
    <script type="text/javascript" language="javascript">window.open("foo_query_select.php","_top")</script>
    this works OK in Mozilla, funny frame refresh of foo_query.php before it redirects to foo_query_resul ts.php but I can live with that BUT it does not work in IE, just (seemingly) refreshes foo_query_selec t.php

    (ii)
    Code:
    <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_que ry_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... :-)

    Regards,
    GREG...
    Last edited by ronverdonk; Feb 26 '08, 04:30 PM. Reason: code tags
  • eWish
    Recognized Expert Contributor
    • Jul 2007
    • 973

    #2
    Moving to the PHP Forum.

    --Kevin

    Comment

    • scubak1w1
      New Member
      • Feb 2008
      • 53

      #3
      OK, it turns out that IE would use the window.open("ur l") 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 -->
      <?php
      if(isset($_POST['query_with_par ameters'])) //where 'query_with_par ameters' 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_sele ct" onsubmit="retur n js_fun_check_en try(this);">
      <input type="hidden" name="_submit_c heck" value="1" />
      <!-- guts of the form -->
      </form>
      <?php
      if(array_key_ex ists('_submit_c heck', $_POST))
      {
      //code to run
      }
      ?>

      Comment

      Working...