Testing issues with IE 7

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
peterp69
Forum Newbie
Posts: 2
Joined: Mon Apr 09, 2007 11:17 am
Location: Chicago, USA

Testing issues with IE 7

Post by peterp69 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I'm running in to an issue with SESSIONS on IE 7.  I tested out correctly on Opera 9.10 and Firefox 2.0.

I am running a form with username submission on PAGE 1. Using a form processor file which changes over from POST to SESSION then redirectoring to a SESSION value print page - PAGE 2.  On PAGE 2 in IE a new SESSION is created and the values from old one do not transfer over.  

I don't know what I can do to make it work properly in IE.  PLEASE help.

PAGE1.php

Code: Select all

<?PHP
	header ("Expires: Wed, 31 May 2004 10:17:17 GMT");    // Date in the past
	header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
	header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
	header ("Pragma: no-cache");                          // HTTP/1.0

	
?>
<form action="formprocessor.php" method="post" enctype="multipart/form-data" name="form1">
  <label>User Name :
  <input name="username" type="text" id="username" size="20" maxlength="20">
  </label>
  <p>
    <label>
    <input type="submit" name="submit" value="submit">
    </label>
  </p>
  </form>

FORMPROCESSOR.PHP
<?PHP
	

	if(!isset($_SESSION))
	{
		session_start();
	}

        if(isset($_POST['submit'])
        {
	       foreach($_POST as $key => $value)
	       {
		       $_SESSION[$key]=$value;
	       }
	       header("Location: http://localhost/page2.php");
	}
?>

PAGE2.php
<?PHP
	header ("Expires: Wed, 31 May 2004 10:17:17 GMT");    // Date in the past
	header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
	header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
	header ("Pragma: no-cache");                          // HTTP/1.0

	if(!isset($_SESSION))
	{
		session_start();
	}
	foreach($_SESSION as $key => $value)
	{
		echo "<BR>Here is session : ".$key ." => ".$value;
	}
	
?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Last edited by peterp69 on Mon Apr 09, 2007 5:31 pm, edited 1 time in total.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Code: Select all

if(isset($_POST['submit']
missing parenthesis.?

and please use

Code: Select all

tags in future.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Stop making the session_start() call as a condition of a set session. Always call it.

Try checking your browser cache settings and your cookie settings as well.
peterp69
Forum Newbie
Posts: 2
Joined: Mon Apr 09, 2007 11:17 am
Location: Chicago, USA

Post by peterp69 »

Everah and ole - Thank you very much for info. It helped a lot, its working now.
Post Reply