imi_99 Posted April 16, 2008 Share Posted April 16, 2008 Hello, I have come across one major issue. I put search on my site and when i do search it shows the result. And when i click on details of any search result and it show the details. But from here if i use back button then it dont show the previous search result again and comes up with page cannot be displayed with error message given below "Click on the Refresh button on the toolbar to reload the page. After refreshing, you might need to navigate to the specific webpage again, or re-enter information. " How can avoid this issue and how can i show search result again when click on back button from top of browser Quote Link to comment Share on other sites More sharing options...
jonsjava Posted April 16, 2008 Share Posted April 16, 2008 could you let us see the code, so we can see how it's giving you the error? We can't do much unless we know how it's doing the search and redirect. Quote Link to comment Share on other sites More sharing options...
imi_99 Posted April 16, 2008 Author Share Posted April 16, 2008 Please use search on this page as an example http://www.whatahome.co.uk/ Suppose search for word "ls" it will show you some result. Then click on View details of any of result shown. After viewing details if you click back button from top it will not show you the previous searched result again. that is the issue. Any further question please ask. thanks Quote Link to comment Share on other sites More sharing options...
jonsjava Posted April 16, 2008 Share Posted April 16, 2008 it asks if you want to repost the data, because it generated the previous page with a _POST to fix this, do something like this ("proxy page") for the search field: //search page <form method="POST" action="page1.php"> //rest of stuff here for page1 <?php $go = array(); $go .= $_POST['variable1']; $go .= $_POST['variable2']; //keep on this style until you have it all $search_url = "search.php?".$go['0']; $count = 1; foreach($go as $value){ if ($value != 0){ $search_url .= "&var".$count."=".$value; $count++; } } header("location:".$search_url); ?> and the final page, the search page: <?php //Search page: do your search by parsing through the $_GET vars $var1 = addslashes($_GET['var1']); $var2 = addslashes($_GET['var2']); $var3 = addslashes($_GET['var3']); //and so on. //then add the $vars into your query ?> **EDITED to add some security into the get variables Quote Link to comment Share on other sites More sharing options...
benphp Posted April 17, 2008 Share Posted April 17, 2008 Take your sql out of page1 and put it into a third page, sql.php for example. page1.php > sql.php > search.php This will keep page1.php from wanting to repost. I do this with everything now. Quote Link to comment Share on other sites More sharing options...
jonsjava Posted April 17, 2008 Share Posted April 17, 2008 um...that's what I said. Quote Link to comment Share on other sites More sharing options...
marcus Posted April 17, 2008 Share Posted April 17, 2008 You can easily set a session and if it exists just return "No refreshing" Quote Link to comment Share on other sites More sharing options...
imi_99 Posted April 17, 2008 Author Share Posted April 17, 2008 Thanks for all of your help. All solutions are fine but i got more easy solution which is to use get instead of post data in the form. I have implement in one of site and will change to all sites. Because all site having same issue. thanks again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.