[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

session problem....

Hi i am back with a new problem...

first.php
displays some question from question table in database....

second....
calculates result and send it to next page where to show result......

third....
before displaying result some updation in database like test passed

fourth....
result display.......

i am using session on my whole site.....
and instead of getting values from database, to make site faster i am updating sesson values and put them in databse also....

problem is...on fourth page after displaying result....
when customer clicks back button third page runs and create problem in database.....

ay solution...
0
carchitect
Asked:
carchitect
1 Solution
 
VGRCommented:
either do like some sites I've seen : write in big red "do not press "back" ! " ;-)

or arrange your queries to prevent the problem from occuring, with a REPLACE for instance - I don't know, your message lacks some details about "the problem [created]" ;-)
0
 
foreverfreshCommented:
check session varable in 3. page if found and same in database you can redirect to 4. page
like

<?

if(strlen($sid))
{
  // check database if found
 header( "Location: page4.php" );
}
else
{
// 3.Page content
}
0
 
wickedbobCommented:
Try using javascript to eliminate back button reloading:

<SCRIPT LANGUAGE="JavaScript"><!--
if (document.images)
    location.replace("http://www.somewhere.com/new_page.html");
else
    location.href = "new_page.html";
//--></SCRIPT>

If you need to pass variables to your results page, echo the javascript in PHP and insert them in the url.
NB: In Opera location.replace() will work but only with absolute urls.
0
 
carchitectAuthor Commented:
solved by self
what i did is created a new variable on page 1 with value 0 , on reaching page made it 1,and when on page checked if it is 0 then execute other wise not....
regards
0
 
smerzCommented:
the at least say its solved so its not listed anymore in the list of unanswered questions

by the way foreverfresh's suggestion would have done it too :)

regards smerz
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Tackle projects and never again get stuck behind a technical roadblock.
Join Now