Re: passing variables to subsequent pages

From: Date: Sun, 02 Nov 2003 14:08:58 +0000
Subject: Re: passing variables to subsequent pages
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-168328@lists.php.net to get a copy of this message
On Sun, 2 Nov 2003 07:44:29 -0600, you 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? Flip to POST instead of GET, for the sake of neatness. The key to passing multiple values is the "[]" at the end of the checkbox name in the form: <? if (isset ($fruit)) { print_r ($fruit); } ?> <form method="post" action="<? echo($PHP_SELF); ?>"> <p><input type="checkbox" name="fruit[]" value="apple"> Apple</p> <p><input type="checkbox" name="fruit[]" value="orange"> Orange</p> <p><input type="checkbox" name="fruit[]" value="pear"> Pear</p> <p><input type="checkbox" name="fruit[]" value="banana"> Banana</p> <p><input type="checkbox" name="fruit[]" value="tangerine"> Tangerine</p> <p><input type="submit" name="Go" value="Go"></p> </form>

« previous php.general (#168328) next »