Re: passing variables to subsequent pages

From: Date: Sun, 02 Nov 2003 13:58:34 +0000
Subject: Re: passing variables to subsequent pages
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-168327@lists.php.net to get a copy of this message
On Monday, November 3, 2003, at 12:44 AM, Robb Kerr wrote:
I have a two page search. The first page queries a database and creates a list of MANUFACTURERS from which the visitor can select all, one or multiple entries. The page is submitted via GET to the second page of the search. The second page uses the array of selected MANUFACTURERS to create a selectable list of MODELS from which the visitor can select all, one or multiple entries. This page is then submitted to the results page via GET. The problem is that to correctly query the database for results, I need to get the array of selected MANUFACTURERS to the results page. I'm using a SUBMIT button and don't know how to include this information in the URL being passed. Any suggestions?
If you're using a submit button, then you can have a hidden form field: <form ...> <input type='hidden' name='manufacturer' value='<?=$_GET['manufacturer']?>' /> <input type='submit' ...> </form> of just add it to the URL of the form action: <form action='nextpage.php' method='get'> ... </form> becomes: <form action='nextpage.php?manifacturer=<?=$_GET['manufacturer']?>' method='get'> ... </form> Make sense? You could also consider sessions, cookies, etc etc. Justin French

« previous php.general (#168327) next »