Jump to content

Script works in Firefox, not IE.


mrMarcus

Recommended Posts

Hey all .. used to frequent the site when i was in learning stages, but have yet to make a post 'til now.

 

Anyways...

 

The code below works just fine in Firefox, but fails in IE.  What i mean by fails is that when this script is executed/called on by my form (on another page), in IE this page just shows up blank with no redirection using the Switch statement.

 

<?php
//////////////////
//REQUIRED FILES//
//////////////////
require("/home/********/public_html/connect.php"); // Database connection
require("/home/********/public_html/init2.php"); // Initiation

/////////////
//FUNCTIONS//
/////////////

// Form validation functions for listing submit
function alpha_numeric($str){
return ( ! preg_match("/^([-a-z0-9])+$/i", $str)) ? FALSE : TRUE;
}
function valid_email($str){
return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
}

////////////////////////
//PREDEFINED VARIABLES//
////////////////////////
$uri = $_SERVER["REQUEST_URI"];
$referer = $_SERVER["HTTP_REFERER"];
// End

// Execute
if(sizeof($_POST) > 0){
      if(isset($_POST["slFormStepOne"])){
            $i = "step2";
      }
      if(isset($_POST["slFormStepTwo"])){
            $i = "step3";
      }
      if(isset($_POST["slFormStepThree"])){
            $i = "step4";
      }
      if(isset($_POST["slFormStepFour"])){
            $i = "step5";
      }
}else{
      header("Location: /");
}
// Case switches      
switch ($i){      
      case step2:
            header("Location: /submit/step2/");
            break;
      case step3:
            header("Location: /submit/step3/");
            break;
      case step4:
            header("Location: /submit/step4/");
            break;
      case step5:
            header("Location: /submit/step5/");
            break;
}
?>

 

Now, if i change this piece of the code like so, it works just fine in IE:

// Execute
if(sizeof($_POST) > 0){
      if(isset($_POST["slFormStepOne"])){
            header("Location: /submit/step2");  //<---change made here.
      }
      if(isset($_POST["slFormStepTwo"])){
            $i = "step3";
      }
      if(isset($_POST["slFormStepThree"])){
            $i = "step4";
      }
      if(isset($_POST["slFormStepFour"])){
            $i = "step5";
      }
}else{
      header("Location: /");
}

 

Any thoughts?

Link to comment
https://forums.phpfreaks.com/topic/103772-script-works-in-firefox-not-ie/
Share on other sites

Either way, still doesn't work in IE.  I don't understand (at fear of sounding naive), how it could work in Firefox and not IE.  it's not as though i'm adding design which i know different browsers handle those kinds of things different.

 

Since PHP is obviously a server-side language, i didn't think browser's came into play.

 

Any other thoughts?

You guys are gonna kill me :-[

 

what it ended up being was that i am using an image in place of a standard submit button, ie. (

<input type="image" .. etc...>

 

IE wasn't able to pass anything along because of that, so all i ended up having to do was add this to my php code (*Note the '_x' which is makes brings it all together):

 

if(isset($_POST["slFormStepOne"]) || isset($_POST["slFormStepOne_x"])){
            $i = "step2";
}

 

Apparently IE does not send the "name/value" tags, but instead, just a set of x/y coordinates.

 

Thanks for the help though, everybody.  Sorry about wasting anybody's efforts:(

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.