right now i’m testing the different uniform fields.
<div>
<label for="receive-copy">
<input type="checkbox" name="_receive_copy" id="receive-copy" <?php e($form->value('_receive_copy'), ' checked')?>/> Receive a copy of the sent data
</label>
</div>
all fields work just fine… but… with the checkbox-field i get the
following error message via mail if the checkbox has not been checked:
<br />
<b>Notice</b>: Undefined index: _receive_copy in <b>/home/url/www/dev.testing.net/site/snippets/uniform/contactform-mail.php</b> on line <b>15</b><br />
_receive_copy:
when the checkbox has been checked i get a correct
message like this: _receive_copy: on
what do I miss?
thanx a lot for your help!
…and an additional question.
is it possible to check and transmit multiple checkbox values?
something like this:
The state of a checkbox is only submitted with a form if it is checked. This means that there is no on or off if the checkbox was checked or not but there is either on or nothing at all. In the line above you assume that the _receive_copy key is always present in the form although it only is if the checkbox was checked, hence your “undefined index” error if it is not. To fix this line you could do something like this: