Hi all,
Please could you help me out with my problem here...
I have created a web interface that allows a user to email a number of people by ticking checkboxes corresponding with the recipients name.
However, my problem is that when the user checks more than one checkbox the emails will not send.
The email will send if only one checkbox is ticked.
Please help me.
Here is my php code containing email addresses, checkboxes, etc..
<?php
function people()
{
echo '<table width="400" border="0" id="email" summary="select the people you would like to contact">
<tr>
<td>Liam</td>
<td><input type="checkbox" name="rep[]" value="liam@yahoo.co.uk"></td>
</tr>
<tr>
<td>Philip</td>
<td><input type="checkbox" name="rep[]" value="phil@yahoo.com"></td>
</tr>
<tr>
<td>John</td>
<td><input type="checkbox" name="rep[]" value="john@hotmail.com>"></td>
</tr>
</table>';
}
?>
Here is the PHP code that sends the email...
<?php
// create short variable names
$name=$HTTP_POST_VARS['name'];
$your_email=$HTTP_POST_VARS['email'];
$phone=$HTTP_POST_VARS['phone'];
$address=$HTTP_POST_VARS['address'];
$rep=$HTTP_POST_VARS['rep'];
$message = $HTTP_POST_VARS['message'];
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1 \r\n";
$headers .= "From:email\n";
$subject = ucwords($HTTP_POST_VARS['subject']);
// email TDs
$email=implode(',',$rep);
echo '<h2>Thank you '.ucwords($name).' for your email</h2>';
mail($email, $subject, $content, $headers);
?>
</p>
Thank you for youur time and help.
Kevin.