Forum Moderators: coopster

Message Too Old, No Replies

session problem

         

kristof_v

8:43 pm on Feb 23, 2006 (gmt 0)

10+ Year Member



hi,

i've put these lines on top of index.php:
<?php
session_start();

if (isset($_SESSION['gebruikersnaam']) && isset($_SESSION['paswoord'])) {
echo '<div style="color:#0073c3; font-weight:bold; font-size:11px;" align="right">U bent ingelogd als: '.$_SESSION['gebruikersnaam'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>';
}
?>

now i also have a search function.
when a user performs a search he gets the results of that search.
he can click on a search result to view the details.
on that detail page he can click on a link to go back to the search results.

the code behind that link is:
echo '<a href="javascript:history.go(-2)">&lt;&lt; terug naar producten</a>';

but, however, when the user clicks that link he gets a warning that the page he is trying to view contains POSTDATA that has expired from cache.

but, when i leave the session_sart()
....
out of index.php he doesn't get that error.

how can i fix this?

grtz

Anyango

3:30 am on Feb 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if on your search form you have only like 1 or 2 fields or u can say few small input fields, then simply set

<form method="get" action="whatever" name="whatver">

that 'll solve it ;)

because the POST data isnt part of the URL you want to load when he presses back button thats why you get that prompt, in case of GET, user's input data will be part of the URL of search results page so you can go back easily

:P

kristof_v

8:51 am on Feb 24, 2006 (gmt 0)

10+ Year Member



that only works partly :(

when user clicks on search he is directed to index.php?page=search

with method="get" this is the result:
[......]

but that should be [......]

all pages should be called by index.php?page=...

another idea?

thx for reply so far :)

Anyango

9:59 am on Feb 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



pretty simple

in your form create a hidden field like this

<input type=hidden name=page value=search>

when user submits search, url would become

[......]

instead of

[......]

;)

kristof_v

10:08 am on Feb 24, 2006 (gmt 0)

10+ Year Member



ok thanks a lot!

that works like a charm :)