0

I have a big problem with losing session in my PHP code. I have 3 form (like a 3 steps), when I'm going from 2. to 3. session loses my data from 1. to 2. step. It gives me only current elements from 2. to 3.

Really I don't know what is the reason... :( I tried yesterday by 10h...

This problem is on IE and Chrome, in Opera it's working normally.

I was looking for in Google:

chrome loses session variables between pages

I found three websites:

1. Link - about favicon.ico - after added, nothing helped...

2. SOF - similar problem - but also nothing...

I tried add to code:

session_write_close();
session_save_path('/homez.764/name/tmp/');

HTACCESS on SOF:

.htaccess also does't help (about favicon):

#<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/.*(themes|wysiwyg|images|js)/
RewriteRule ^favicon.ico$ favicon.ico [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php
#</IfModule>

(Yes, I use session_start() on every site)

Please, help me if you can, I've never spent so much time on the forms...

Thanks in advance!

---- EDIT 09:38 ----:

on 2. page session array:

Array ( [krajnadania] => Anglia [nadanie] => 10 [doreczenie] => Polska [odbior] => Sobota [ilosc] => 1 [waga] => 1 [wys] => 1 [gleb] => 1 [szer] => 1 [wynik] => 5.00 [koszt] => [zawartosc] => [uwagi] => )

on 3. page:

Array ( [krajnadania] => [nadanie] => [doreczenie] => [odbior] => [ilosc] => [waga] => [wys] => [gleb] => [szer] => [wynik] => [koszt] => 20 £ [zawartosc] => Sth1 [uwagi] => Sth12 )

CODE:

Second page:

session_start();

$_SESSION['krajnadania'] = $_POST['krajnadania'];
$_SESSION['nadanie'] = $_POST['nadanie'];
$_SESSION['doreczenie'] = $_POST['doreczenie'];
$_SESSION['odbior'] = $_POST['odbior'];
$_SESSION['ilosc'] = $_POST['ilosc'];
$_SESSION['waga'] = $_POST['waga'];
$_SESSION['wys'] = $_POST['wys'];
$_SESSION['gleb'] = $_POST['gleb'];
$_SESSION['szer'] = $_POST['szer'];
$_SESSION['wynik'] = $_POST['wynik'];
print_r($_SESSION);

Third page:

session_start();

$_SESSION['koszt'] = $_POST['koszt'];
$_SESSION['zawartosc'] = $_POST['zawartosc'];
$_SESSION['uwagi'] = $_POST['uwagi'];
print_r($_SESSION);

---- EDIT 14:04 ----:

Amazing, but problem is still... I wrote session var 'sth' in 1. file

<?php
session_start();

$_SESSION['sth'] = 'STH';
print_r($_SESSION);
?>

and i print session on every page, this is the effect:

1:

Array ( [sth] => STH [krajnadania] => [nadanie] => [doreczenie] => [odbior] => [ilosc] => [waga] => [wys] => [gleb] => [szer] => [wynik] => [koszt] => [zawartosc] => [uwagi] => )

2:

Array ( [sth] => STH [krajnadania] => Anglia [nadanie] => 10 [doreczenie] => Polska [odbior] => Sobota [ilosc] => 2 [waga] => 1 [wys] => 1 [gleb] => 1 [szer] => 1 [wynik] => 5.00 [koszt] => [zawartosc] => [uwagi] => )

3:

Array ( [sth] => STH [krajnadania] => [nadanie] => [doreczenie] => [odbior] => [ilosc] => [waga] => [wys] => [gleb] => [szer] => [wynik] => [koszt] => 40 £ [zawartosc] => cos2 [uwagi] => cos1 )

$_SESSION['sth'] is visible for every page and it is not clearing...

---- EDIT 17:28 ----:

I found probably the cause of this problem. When I deleted all include files in my index.php it started to work. Later I included step by step files and...

When I have nivo-slider (jQuery images slider) it is not working, when I delete lines:

<div class="slider-wrapper theme-default">
<div id="slider1" class="nivoSlider">
<img src="images/1.jpg" data-transition="fade" alt="" border="0" />
<img src="images/2.jpg" data-transition="fade" alt="" border="0" />
<img src="images/3.jpg" data-transition="fade" alt="" border="0" />
<img src="images/4.jpg" data-transition="fade" alt="" border="0" />
</div>
</div>

Sessions are working :) I'm still looking for the problem.

Community
  • 1
  • 1
Daniel
  • 128
  • 1
  • 2
  • 12
  • Can you confirm pages 2 and 3 are getting the session cookie? My first instinct is that something is either removing the PHP session cookie, or preventing it from being transmitted – Aaron Dougherty Oct 12 '13 at 07:29
  • I tried to print session_id(), and it is same on both pages. Also I was trying to change $_SESSION to $_COOKIE but it was same. – Daniel Oct 12 '13 at 07:34

0 Answers0