Re: radio groups in looped form

From: Date: Thu, 12 Apr 2001 00:20:25 +0000
Subject: Re: radio groups in looped form
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48221@lists.php.net to get a copy of this message
by this I mean, html code of the form: <FORM NAME="form1" METHOD="post" ACTION=""> <INPUT TYPE="radio" NAME="radiobutton" VALUE="radiobutton"> <INPUT TYPE="radio" NAME="radiobutton" VALUE="radiobutton"> INPUT TYPE="radio" NAME="radiobutton" VALUE="radiobutton"> <INPUT TYPE="radio" NAME="radiobutton" VALUE="radiobutton"> <INPUT TYPE="radio" NAME="radiobutton" VALUE="radiobutton"> </FORM> <FORM NAME="form2" METHOD="post" ACTION=""> <INPUT TYPE="radio" NAME="radiobutton" VALUE="radiobutton"> <INPUT TYPE="radio" NAME="radiobutton" VALUE="radiobutton"> INPUT TYPE="radio" NAME="radiobutton" VALUE="radiobutton"> INPUT TYPE="radio" NAME="radiobutton" VALUE="radiobutton"> INPUT TYPE="radio" NAME="radiobutton" ALUE="radiobutton" </FORM> radiobuttons with the same name, in the same FORM tag will always be considered a group. if they are in separate form tags, they should be separate groups, even if the form does not have a name (unless the browser is buggy) the way around this is multidimensional arrays printing your radio buttons as name="avail[1][]" will put make different subgroups or radio buttons every time you change the index in the first []. but, if you truly have separate form tags, the only data that is going to get sent back, is the data within that for, doesn't matter WHAT the other buttons in the other forms say. personally, I try to stay away from multiple forms per page. in a situation like yours sounds to be, I like to put a hidden field on each line that is mykey[] and set the value to a unique id in the database. I can then put a lot of data into multiple rows, enabling me to update a whole group of data at once. I still have to send one update to my database per row, but what the hell. On 4/11/01 5:07 PM, "Lindsay Adams" <lindsay@dingos.net> wrote: > My question: > > are the groups all within different forms? does each for have a different > name? don't know, something to try. > > > On 4/11/01 5:05 PM, "Peter Houchin" <peterh@vfsa.com.au> wrote: > >> even though i am putting them in an array? >> >> like >> >> <input type="radio" name="avail[]" value="y" <? if >> ($avail == 'y') { echo >> 'CHECKED'; }?>> >> >> (i have another 2 radio buttons with this group) >> >> Peter >> >> -----Original Message----- >> From: SED [mailto:sed@sed.is] >> Sent: Thursday, April 12, 2001 10:05 AM >> To: Peter Houchin >> Cc: Php-General@Lists.Php.Net >> Subject: RE: [PHP] radio groups in looped form >> >> >> I don't think you can. The browser groups them by the name, so you will have >> to write some code (simple) to change the name... >> >> SED >> >> -----Original Message----- >> From: Peter Houchin [mailto:peterh@vfsa.com.au] >> Sent: 11. apríl 2001 23:33 >> To: Php-General@Lists. Php. Net >> Subject: [PHP] radio groups in looped form >> >> >> hiya, >> >> I have a script that repeats a form x number of times depending on how many >> records there are, what's happening is when i go to update my radio buttons >> it sees every radio button on the page as the ONE group when really it's x >> number of groups (again depending on how many records there are) >> >> How can i differ between raido groups with out having to get the name >> changed for every record after the 1st one? >> >> Peter Houchin >> peterh@sunrentals.com.au >> ========================================================= >> _____ __ /\ >> /_/_/_\ / |_/ \ >> /_/_/_ __ __ __ __ / \ >> \_/_/_\ /_/ /_/ /_/ /_/ \ _ / >> ___\_\_\/ /_/_/_/ /_//\/_/ \_/ \/\_/ >> \_//_/_/ /_/_/_/ /_/ \/_/ v >> ________ ________________________________________ >> /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ >> /_/_ _/_/ ______ __ __ /_/ ____ __ ______ >> /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\ /_/ /_/_/_/ >> /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ >> /_/ \_\/_/_/_/ /_/ \/_/ /_/ /_/ \_\/_/_/_//_/_/_/ >> ========================================================= >> Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 >> ************* We rent the dot in .COM! ************** >> >> >

« previous php.general (#48221) next »