Re: How to Retrieve All Selected Values of CheckBox Group in Form?

From: Date: Thu, 13 Sep 2001 04:36:19 +0000
Subject: Re: How to Retrieve All Selected Values of CheckBox Group in Form?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-67134@lists.php.net to get a copy of this message
http://php.net/FAQ.php -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Hon-Chi Ng <honchi_ng@my-deja.com> Newsgroups: php.general To: <php-general@lists.php.net> Sent: Wednesday, September 12, 2001 6:42 PM Subject: How to Retrieve All Selected Values of CheckBox Group in Form? > Hi > > How I read the all values selected for checkboxes of same name that are > submitted to HTML form? > > I tried to translate the example on CGI.pm homepage to PHP below. > > <FORM METHOD=POST> > What's your name? <INPUT TYPE=TEXT NAME="name" VALUE="<?= $name > ?>"> > <P> > What's the combination? > <P> > <INPUT TYPE=CHECKBOX NAME="words" VALUE="eenie" CHECKED>eenie > <INPUT TYPE=CHECKBOX NAME="words" VALUE="meenie">meenie > <INPUT TYPE=CHECKBOX NAME="words" VALUE="minie" CHECKED>minie > <INPUT TYPE=CHECKBOX NAME="words" VALUE="moe">moe > <P> > <P> > <INPUT TYPE=SUBMIT> > </FORM> > <P> > <HR> > Your name is <EM><?= $name ?></EM> > <P> > The keywords are <EM><?php echo "$words" ?></EM> > <P> > > Echoing the value of $words in PHP always display the last one only, > regardless of the number of choices for "words" checkboxes have been > selected. > > On the other hand, if param('words') is used with CGI.pm, it displays all > the selections for "words" checkboxes. > > > FYI, below are some of info displayed by the phpinfo(). > > Version: 4.0.6 > System: SunOS 5.7 > Configure Command: './configure' '--with-apache=../apache_1.3.20' '--enable-ftp' -- enable-versioning' --enable-track-vars' > Server API: Apache > Virtual Directory Support: disabled > ZEND_DEBUG: disabled > Thread Safety: disabled > > > Thanks. I'm new to PHP, and any specific and detail explanations are > appreciated. > > Regards > Hon-Chi > > > ------------------------------------------------------------ > --== Sent via Deja.com ==-- > http://www.deja.com/

« previous php.general (#67134) next »