Re: from Checkboxes to e-mail
| From: | Matthew Leverton | Date: | Tue, 20 Jun 2000 16:19:20 +0000 |
| Subject: | Re: from Checkboxes to e-mail | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-2320@lists.php.net to get a copy of this message | ||
Try this:
<INPUT TYPE=CHECKBOX NAME="Options[]" VALUE=Black>Black
<INPUT TYPE=CHECKBOX NAME="Options[]" VALUE=White>White
<INPUT TYPE=CHECKBOX NAME="Options[]" VALUE=Grey>Grey
Notice the square brackets. PHP will put the checked ones into an array.
You will then need to loop through them like this:
$temp = "";
for ($i=0; $i<sizeof($Options); $i++) {
$temp .= "$Options[$i]\";
}
This would cause $temp to contain a list of the selected options.
There are numerous ways to loop through the $Options array, use
whatever works best for you.
--
Matthew Leverton - matthew@aeroinc.net -
http://www.allegro.cc
-----Original Message-----
From: Martin E. Koss <mek@mek.co.uk>
To: php-general@lists.php.net <php-general@lists.php.net>
Date: Tuesday, June 20, 2000 11:14 AM
Subject: [PHP-GENERAL] from Checkboxes to e-mail
>Hi,
>I've read numerous entries about getting selected checkbox values
recognised
>but haven't been able to figure out my dilema.
>
>I hava group of check boxes on a form:
>
><INPUT TYPE=CHECKBOX NAME="Options" VALUE=Black>Black
><INPUT TYPE=CHECKBOX NAME="Options" VALUE=White>White
><INPUT TYPE=CHECKBOX NAME="Options" VALUE=Grey>Grey
>
>And when I compile the e-mail, I want to slot these selected itmes into the
>message:
>
>mail("$SentBy", "$Subject", $Message,
>"From: $Email\nReply-To: $Email\n
>Options - $Options <-- NEED THEM HERE
>");
>
>Any suggestions?
>
>Thanks.
>
>Martin E. Koss
>Active Media Solutions / Paradox IT Limited
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>