Forum Moderators: coopster

Message Too Old, No Replies

IE not registering $ SESSION variables when redirecting via header (lo

         

justgowithit

6:52 pm on Sep 20, 2006 (gmt 0)

10+ Year Member



The following is some code from a multi-page registration form. The registration process is managed by sessions and eventually posted to a db. The system works fine with Firefox, Nextscape, and any other browser with the exception of OPERA and IE (any version).

For some reason IE and OPERA are not finding the session variable (in this case $_SESSION[‘terms’]) after redirection using header(location:’thepage.php’). Part of the problem seems to be that each page validates itself. I’ve remedied the problem by using another URL for validation and registering $_SESSION variables, but for a number of reasons I’d like to keep everything on the same page.

I’ve done a lot of reading about IE and its finicky nature with headers but nothing seems to solve the issue. Any ideas?

-PHP is running as a CGI module which I tend to think may have something to do with this.

Any help is greatly appreciated.

<?php
session_start();
// Include the configuration file for error management and such.
require_once ('config.inc.php');

if (isset($_POST['submitted'])) { // Handle the form.
require_once ('mysql_connect.ini.php');

if (isset($_POST['terms'])){//make sure the visitor clicked a choice

if (eregi('^[a-zA-Z]{10,12}$', stripslashes(trim($_POST['terms'])))) {
$terms = escape_data($_POST['terms']);

if ($terms === 'acceptTerms'){
$_SESSION['Terms'] = $terms;
header ("Location: [somesite.com...]
exit;

} else {
echo 'Error - The system has encountered an error.';
}

} else {
echo 'No terms - no go';
}

} else { //else for missing terms -- show visitor error notification prompting a choice

//<!-- Error array form message here form here -->

}// end error notification conditional

} else { //the form has not been submitted - show the page

//<!-- Not yet submitted html form here -->

}
?>

justgowithit

4:59 pm on Sep 21, 2006 (gmt 0)

10+ Year Member



oh well, after hours of fooling around with php code, session functions, and server configs it turns out that IE and Opera simply don't like graphical submit buttons on a post-back form.

I changed the graphical submit buttom to straight html and everything worked fine.

For what it's worth if anyone else is having a similar issue.

coopster

7:13 pm on Sep 21, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are you saying you are using an image for the submit button? If so then you are likely experiencing this issue with MS IE ...
[webmasterworld.com...]