mrMarcus Posted May 1, 2008 Share Posted May 1, 2008 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 More sharing options...
DarkWater Posted May 1, 2008 Share Posted May 1, 2008 PHP scripts are server side, and are therefore browser independent. When you redirect, ALWAYS use a full URL, because browsers like it. A lot. And then it works. Link to comment https://forums.phpfreaks.com/topic/103772-script-works-in-firefox-not-ie/#findComment-531297 Share on other sites More sharing options...
mrMarcus Posted May 1, 2008 Author Share Posted May 1, 2008 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? Link to comment https://forums.phpfreaks.com/topic/103772-script-works-in-firefox-not-ie/#findComment-531306 Share on other sites More sharing options...
DarkWater Posted May 1, 2008 Share Posted May 1, 2008 It doesn't work with an absolute URL? Link to comment https://forums.phpfreaks.com/topic/103772-script-works-in-firefox-not-ie/#findComment-531307 Share on other sites More sharing options...
mrMarcus Posted May 1, 2008 Author Share Posted May 1, 2008 Nada. Page just dies with no error(s) (just a blank page, no source), with no redirection. Can't figure out where it's conking out and why. But like i said, it's works without hitch in Firefox. Link to comment https://forums.phpfreaks.com/topic/103772-script-works-in-firefox-not-ie/#findComment-531319 Share on other sites More sharing options...
realjumper Posted May 1, 2008 Share Posted May 1, 2008 What if you make yopur url absolute and add the file name.....so instead of http://www.your_server.com/submit/step2 you have: http://www.your_server.com/submit/step2/index.php Link to comment https://forums.phpfreaks.com/topic/103772-script-works-in-firefox-not-ie/#findComment-531324 Share on other sites More sharing options...
mrMarcus Posted May 1, 2008 Author Share Posted May 1, 2008 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:( Link to comment https://forums.phpfreaks.com/topic/103772-script-works-in-firefox-not-ie/#findComment-531339 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.