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/
--
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]