Page 1 of 1

Just a simple question about PHP and new page

Posted: Thu May 19, 2005 10:29 am
by paolo
Hello,
I'm making a page to search into database for some user, I put the result into a page called result.php. In the columns of the tables that I fill from Mysql I've made an additional one that is a link to detailed info about user, my problem is that I can go to the detailed infos but when I return back using button or back button of browser I receive an error that the page in unavaiable; the reason is that the page is created on fly and I don't save the resutls (4000 entries are a lot and don't even want to think of saving into variables session).My question is how I open a new page with PHP? and second Q, it's possible after having shown/modified data of the user to refresh the first page??
Thanks a lot!
Paolo

Just a simple question about PHP and new page

Posted: Tue May 24, 2005 12:18 pm
by kendall
Paolo,

Well when you do a search you bring the results of the data to the page right?

Ok then. each result should have a unique ID? am i right?

You use this reference the data you will need to get when u click the "link to detailed info about user"

Now firstly because the results page is dynamic the data is created on the fly based on parameters and prcoess from your search. So when you want to go back to that results right? Then you need to re-create the process that got you the results in the first place. This means having to reference the query/ search terms used to get the results in the first place and going back through the whole search process?...usually its something like this

Code: Select all

echo "<a href=\"search.php?searchterm=". echo $searchterm; ."\">BACK</a>"; // searchterm represents the input field name or variable used in passing the query term
Well this is one way...
The other way would be the answer to your second question....Open a new window to display the detailed information

Code: Select all

echo "<a href=\"details.php?ID=".$results['ID']."\" target=\"_blank\">click the link for detailed info</a>"; // ID represents the php variable or what have u that reference the unique id number of the data to get from the database to be shown on the details info page. this u should find in your results data from mysql table. check your tables for this
Of course there is the issue of whether your using $_POST or $_GET to retrieve passed variables to php files the method used here is $_GET and you will need to probably use $_REQUEST which is like a auto-detect. see php documentation for more details.