On Saturday 19 January 2002 14:45, K.Tomono wrote: > Yes, I think too, it's better way to use an array rather than a dynamic > name of the variable. > > I thought that the first question means how to use a dynamic variable. > > By the way, > > > little array propaganda, jic :) Arrays work great in forms too! > > > > http://www.php.net/manual/en/faq.html.php#AEN73718 > > Does this technique work fine on the version 3.0.14 later to 3.0.18 > of PHP? (Not PHP4) > > I tried an array in forms simply like below in the other day, > but this didn't work fine... > > ( for the checkboxes ) > <INPUT TYPE="CHECKBOX" NAME="MYCHK" VALUE="A"> > <INPUT TYPE="CHECKBOX" NAME="MYCHK" VALUE="B"> > > Unfortunately, I had thought that it could be got as an array, > but variable $MYCHK is overwritten by the last value "B" always.
I don't know whether the following works for PHP3, but for PHP4 you would use: <INPUT TYPE="CHECKBOX" NAME="MYCHK[A]" VALUE="A"> <INPUT TYPE="CHECKBOX" NAME="MYCHK[B]" VALUE="B"> You could even use multi-dimensional arrays: <INPUT TYPE="CHECKBOX" NAME="MYFORM[CHECKBOX][A]" VALUE="A"> You would reference this as $MYFORM['CHECKBOX']['A'] in your php code. hth -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* If a subordinate asks you a pertinent question, look at him as if he had lost his senses. When he looks down, paraphrase the question back at him. */ -- 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]