Forum Moderators: coopster
<FORM ACTION="test.php" METHOD=POST>
<P> Please tell us what you thought of this Web site. Select the checkboxes which you agree with: </P>
<UL>
<LI><INPUT TYPE=chECKBOX NAME="opinion" VALUE="understandable">
The text was understandable.
<LI><INPUT TYPE=chECKBOX NAME="opinion" VALUE="navigable">
I found it easy to find my way through the Web site.
<LI><INPUT TYPE=chECKBOX NAME="opinion" VALUE="stylish">
I was impressed by the style and presentation.
</UL>
<P> <INPUT TYPE="HIDDEN" NAME="pages" VALUE="brochure">
Please add any other comments:
<TEXTAREA NAME="feedback" ROWS=5 COLS=40>
I think your brochure is:
</TEXTAREA>
</P>
<P> <INPUT TYPE=SUBMIT VALUE="Send comments">
<INPUT TYPE=RESET VALUE="Clear form"> </P>
</FORM>
i try to print out all the checkbox value....
i check all the boxes and click the submit....
and my test.php is only:
print $_POST['opinion'];
but it prints out only "stylish" (the last checkbox value)
can somebody help me with this....coz i can't print the whole checkbox value even i've checked all the boxes?
In the HTML form, name your checkbox inputs as an array like so:
<INPUT TYPE=chECKBOX NAME="opinion[]" VALUE="understandable">
Do that with all of them, then in your script you can loop the array to get all the values:
foreach ($_POST['opinion'] as $val){
print $_POST['opinion'][$val] . '<br />';
}
Regards,
Birdman
PHP and HTML [php.net]