Jump to content

Sessions not working


Asheh

Recommended Posts

I have a site below:

 

http://www.nngb-evaluation.co.uk/acrylic_new/

 

When you click an image, it uses GET to submit to the iframe above. then it switches each session variable to the selected one, and so on.

 

Unfortunately im not getting the desired effects AT ALL, you select the first one, it messes up the second one and so on!

 

Whats the deal with sessions?

 

Ash.

Link to comment
https://forums.phpfreaks.com/topic/44771-sessions-not-working/
Share on other sites

As below!

 

This is similar to my problem, does anyone know the fix? what is the problem with the below code???

 

Please!

 

Ash.

 

The session variable is still lost when navigating even if I change $setting or $_SESSION['setting'].

 

If you assign a session subscript/key to the same name as a variable, the session variable will be volatile and lost upon navigating.

 

For example, if passing a setting that you want in $_SESSION, don't do this:

 

<?

$setting = $_REQUEST['setting'];

if (!empty($setting))

  $_SESSION['setting'] = $setting;

?>

 

Instead, rename $setting or $_SESSION['setting'].

Link to comment
https://forums.phpfreaks.com/topic/44771-sessions-not-working/#findComment-217377
Share on other sites

Well its separated into 4 different files.

 

Here is what each IFRAME does with some differences

			<a href="#" onClick="postToIframe('<?=$_SESSION['plate']?>','<?=$_SESSION['custom_text']?>', '<?=$_SESSION['base']?>', '<?=$file_list[$i]?>', '<?=$_SESSION['border']?>','<?=$_SESSION['bordercolour']?>','<?=$_SESSION['ghost']?>');">
			<img src="image_library/badges/thumbs/<?=$thumb_loc?>" border="0" alt="<?=$file_list[$i]?>">
			</a>

 

The iframe which displays the final image does this:

//Set to defaults
if(!isset($_SESSION['badge']) OR strlen($_SESSION['badge'])==0) {
$_SESSION['badge'] = "none";
}

//change of setting requested
if($_GET['badge'] OR $_POST['badge']) {
if(isset($_GET['badge']))
{
	$_SESSION['badge'] = $_GET['badge'];
} else {
	$_SESSION['badge'] = $_POST['badge'];
}
}

 

 

Having many problems though!

 

anyone?

Link to comment
https://forums.phpfreaks.com/topic/44771-sessions-not-working/#findComment-217390
Share on other sites

You can do it without using of session

 

From one frame you can target another frame

 

<iframe name="a" src="displayimage.php?imageid=1">

 

<iframe name="b" src="listofimages.php">

 

in file listofimages.php suppose you have a link

<a href="displayimage.php?imageid=<?php echo $imageid?>" target="a">

Link to comment
https://forums.phpfreaks.com/topic/44771-sessions-not-working/#findComment-217401
Share on other sites

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.