i have a search page where the user will enter some search keywords and click search.in the next page it will display thesearch result.when the user clicks a search result(a link) it will redirect him to the next page which contains the detail result.when he clicks search result link... i want him to see the search results by refreshing the page.so tat currently inserted datas can be viewed

<a href='javascript:history.go(-1)'>Search Result</a>

the above code redirect him to the previous page but it does not refresh the page.

You could alternatively use:

<a href="<?php echo $_SERVER['http_referrer']; ?>">Search Result</a>

this redirecting me to the first page,ijust want to redirect the user to the previous page,i also want the page to be refreshed

<a href="javascript:history.back(-1);">Previous Page</a>

is an option.

Then if you're using php you could start a session $_SESSION, with the page name set differently on each page. For example:

on the page you want where the 'previous page' link is.


$_SESSION['page'] = "this page";

then on the previous page have an IF statement, like follows.


if(isset($_SESSION['page'])) {

    echo "<meta http-equiv='refresh'  content='0.5'>";

} else { }

This means that if the session from the former page is set then it will trigger the meta refresh, thus reloading the page, if the session isn't set (they just came to that page without using the link) then it won't refresh.

Hope that helps?