RE: [PHP] radio groups in looped form
Hi Peter I use this function in one of my scripts. Maybe you can get a few ideas from it. function WriteRadio ($FieldNo, $NOptions, $OptionValue, $Option, $SelectedValue, $NullValue) { /* The Radio function writes a group of HTML INPUT radio buttons. $OptionValue = input value $Option = the option wording in the radio button group $SelectedValue = the option value that is currently checked $NullValue = the first option is empty if true (returns all records for queries) */ if ($NullValue) { echo " N/A"; } for ($i = 0; $i <= $NOptions[$FieldNo]; $i++) { if ($OptionValue[$FieldNo][$i] == $SelectedValue) { echo " ".$Option[$FieldNo][$i]; } else { echo " ".$Option[$FieldNo][$i]; } } return 0; } Rudolf Visagie [EMAIL PROTECTED] -Original Message- From: Peter Houchin [mailto:[EMAIL PROTECTED]] Sent: 12 April 2001 01: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 [EMAIL PROTECTED] = _ __ /\ /_/_/_\/ |_/ \ /_/_/___ __ __ __ / \ \_/_/_\ /_/ /_/ /_/ /_/ \ _ / ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ \_//_/_/ /_/_/_/ /_/ \/_/v /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ /_/_ _/_/ __ __ __ /_/ __ __ /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ = Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 * We rent the dot in .COM! ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] radio groups in looped form
One thing I forgot to mention, you can of course name the group: avail[$i] (see below) so you will able to refer to it as an array in PHP file later on. -- So far as I know, the HTML does not support arrays. However, you can make simple code that adds number to each group so you can refer to them later e.g.: $i = 0; while (your arguments) { echo "name=\avail[$i]\"; $i++; } And afterwards you can refer to it the same way (perhaps you may want to keep the total value of $i in a hidden form field for later use). SED -Original Message- From: Peter Houchin [mailto:[EMAIL PROTECTED]] Sent: 12. apríl 2001 00:05 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: [PHP] radio groups in looped form even though i am putting them in an array? like > (i have another 2 radio buttons with this group) Peter -Original Message- From: SED [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 12, 2001 10:05 AM To: Peter Houchin Cc: [EMAIL PROTECTED] 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:[EMAIL PROTECTED]] 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 [EMAIL PROTECTED] = _ __ /\ /_/_/_\/ |_/ \ /_/_/___ __ __ __ / \ \_/_/_\ /_/ /_/ /_/ /_/ \ _ / ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ \_//_/_/ /_/_/_/ /_/ \/_/v /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ /_/_ _/_/ __ __ __ /_/ __ __ /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ = Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 * We rent the dot in .COM! ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] radio groups in looped form
by this I mean, html code of the form: 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" 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" <[EMAIL PROTECTED]> 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" <[EMAIL PROTECTED]> wrote: > >> even though i am putting them in an array? >> >> like >> >> > 'CHECKED'; }?>> >> >> (i have another 2 radio buttons with this group) >> >> Peter >> >> -Original Message- >> From: SED [mailto:[EMAIL PROTECTED]] >> Sent: Thursday, April 12, 2001 10:05 AM >> To: Peter Houchin >> Cc: [EMAIL PROTECTED] >> 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:[EMAIL PROTECTED]] >> 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 >> [EMAIL PROTECTED] >> = >>_ __ /\ >> /_/_/_\/ |_/ \ >> /_/_/___ __ __ __ / \ >> \_/_/_\ /_/ /_/ /_/ /_/ \ _ / >> ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ >> \_//_/_/ /_/_/_/ /_/ \/_/v >> >> /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ >> /_/_ _/_/ __ __ __ /_/ __ __ >> /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ >> /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ >> /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ >> = >> Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 >> * We rent the dot in .COM! ** >> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] radio groups in looped form
So far as I know, the HTML does not support arrays. However, you can make simple code that adds number to each group so you can refer to them later e.g.: $i = 0; while (your arguments) { echo "name=\avail$i\"; $i++; } And afterwards you can refer to it the same way (perhaps you may want to keep the total value of $i in a hidden form field for later use). SED -Original Message- From: Peter Houchin [mailto:[EMAIL PROTECTED]] Sent: 12. apríl 2001 00:05 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: [PHP] radio groups in looped form even though i am putting them in an array? like > (i have another 2 radio buttons with this group) Peter -Original Message- From: SED [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 12, 2001 10:05 AM To: Peter Houchin Cc: [EMAIL PROTECTED] 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:[EMAIL PROTECTED]] 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 [EMAIL PROTECTED] = _ __ /\ /_/_/_\/ |_/ \ /_/_/___ __ __ __ / \ \_/_/_\ /_/ /_/ /_/ /_/ \ _ / ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ \_//_/_/ /_/_/_/ /_/ \/_/v /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ /_/_ _/_/ __ __ __ /_/ __ __ /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ = Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 * We rent the dot in .COM! ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] radio groups in looped form
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" <[EMAIL PROTECTED]> wrote: > even though i am putting them in an array? > > like > > 'CHECKED'; }?>> > > (i have another 2 radio buttons with this group) > > Peter > > -Original Message- > From: SED [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 12, 2001 10:05 AM > To: Peter Houchin > Cc: [EMAIL PROTECTED] > 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:[EMAIL PROTECTED]] > 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 > [EMAIL PROTECTED] > = >_ __ /\ > /_/_/_\/ |_/ \ > /_/_/___ __ __ __ / \ > \_/_/_\ /_/ /_/ /_/ /_/ \ _ / > ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ > \_//_/_/ /_/_/_/ /_/ \/_/v > > /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ > /_/_ _/_/ __ __ __ /_/ __ __ > /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ > /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ > /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ > = > Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 > * We rent the dot in .COM! ** > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] radio groups in looped form
even though i am putting them in an array? like > (i have another 2 radio buttons with this group) Peter -Original Message- From: SED [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 12, 2001 10:05 AM To: Peter Houchin Cc: [EMAIL PROTECTED] 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:[EMAIL PROTECTED]] 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 [EMAIL PROTECTED] = _ __ /\ /_/_/_\/ |_/ \ /_/_/___ __ __ __ / \ \_/_/_\ /_/ /_/ /_/ /_/ \ _ / ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ \_//_/_/ /_/_/_/ /_/ \/_/v /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ /_/_ _/_/ __ __ __ /_/ __ __ /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ = Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 * We rent the dot in .COM! **
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:[EMAIL PROTECTED]] 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 [EMAIL PROTECTED] = _ __ /\ /_/_/_\/ |_/ \ /_/_/___ __ __ __ / \ \_/_/_\ /_/ /_/ /_/ /_/ \ _ / ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ \_//_/_/ /_/_/_/ /_/ \/_/v /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ /_/_ _/_/ __ __ __ /_/ __ __ /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ = Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 * We rent the dot in .COM! ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[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 [EMAIL PROTECTED] = _ __ /\ /_/_/_\/ |_/ \ /_/_/___ __ __ __ / \ \_/_/_\ /_/ /_/ /_/ /_/ \ _ / ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ \_//_/_/ /_/_/_/ /_/ \/_/v /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ /_/_ _/_/ __ __ __ /_/ __ __ /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ = Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 * We rent the dot in .COM! **