Re: Passing Arguments

From: Date: Fri, 17 Nov 2000 02:30:33 +0000
Subject: Re: Passing Arguments
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25847@lists.php.net to get a copy of this message
On Thu, 16 Nov 2000, Thomas Holton wrote: > > Hello. I have a php file that accesses my mysql database, displays some of > the database data in <select> lists, along with some other listings. This > all works great. What i want to do now is take some of the arguments > that are selected and update the sql database with those values. What i > dont understand is how I am going to pass these selections to a second > php script in order to do the mysql statement there. > So, i guess my question is two part: > 1. Is there some way to use the submit button on the same page to do an > update command, > OR > 2. How do i pass the arguments to another php script where i do know how > to do the new mysql update command. > > Thanks in advance! > tom > Put an array specifier (e.g., "items[]") as the name attribute of the select and make it multiple(e.g., <select name="items[]" multiple>). Then put the value attribute of each option as the value you want to pick up in the array (e.g., <option value="1">Item #1</option>). Then in the called script use: while (list($key, $val)=each($items)) { ... }; to extract the items one at a time. -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.general (#25847) next »