Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi,

Please take a look at the following code:

 

$_SESSION['quote_type'] = 'curtains'; 
	$_SESSION['drop'] = $drop;
	$_SESSION['track_pole_width'] = $track_pole_width;
	$_SESSION['fabric_width'] = $fabric_width;
	$_SESSION['track_pole'] = $track_pole;
	$_SESSION['lining'] = $lining;
	$_SESSION['heading_tape'] = $heading_tape;
	$_SESSION['fullness'] = $fullness;
	$_SESSION['interlined'] = $interlined;

	print_r($_SESSION);

	echo session_id();

 

The

print_r($_SESSION);

works perfectly. Nice long row of array contents. I then opened up another file within the same web site and inserted the same

print_r($_SESSION);

code to make sure that the session information was being carried over.

 

Nothing appeared.

 

So I added the

echo session_id();

code to check the session id and compare it with the other file. No session id appeared when I ran the script.

 

Is it possible for a session to be deleted straight after it was run?

 

Thanks

Paul

Link to comment
Share on other sites

Hi all,

Does anyone have any ideas on this one? I've got a feeling I may be misunderstanding sessions?

 

I thought that once a session had data saved to it then that data was available in any script within that website (in this case localhost), providing that session_start() had been started for the scripts that were involved.

 

If that is correct is echo session_id() correct syntax?

 

Is there a PHP configuration that I need to do?

 

Thanks for any help you can give. If I can't get this to work then, I guess, I'll need to append it all to the url and pass it over that way.

 

Cheers

Paul

Link to comment
Share on other sites

Hi all,

Guess who's been a bonehead! I've worked it out.

 

I have a parent script that has an 'include' that contains session_start(). This same script has 2 'includes' one of which is the curtain quote script that I'm having trouble with.

 

So I make my changes to the curtain quote script and run it through XAMPP. Standing alone it works OK, calculates the quote. It even saves the information in the $_SESSION array and prints it out on screen. However it won't print a session id or take it to another file.

 

It's because I'm not running the script through the parent script that contains the session_start() code. As soon as I do that it works.

 

I only tell you this so that it may help others. I guess the botton line is that if you are testing a file that is in itself an include then you need to test it from the parent file. Does that make sense?

 

Antonio, you might ask your friend if he's using includes!

 

Cheers

Paul

Link to comment
Share on other sites

 Share

×
×
  • Create New...