php - Form with checkbox destinations
I have a problem. I did a form with i can choose who goes it with "checkbox"
The problem is the message is just going to the 2nd destiantion (2nd checkbox), and ignore the other checked.
Can anybody help? Thks
exemple of my code:
...(begining)...
<form action="<?$_SERVER['PHP_SELF']; ?>" method="post">
...(somewhere in the form)...
<input type="checkbox" name="emailto" id="emailto1" value="[email protected]">MV
<input type="checkbox" name="emailto" id="emailto2" value="[email protected]">
...(before all form)...
<?
if ($_POST['submit']){
$titulo = "** BRIEF **";
$sender = "BRIEF<[email protected]>";
$to = $_POST ['emailto'];
$reply = "[email protected]";
$mensagem = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'
'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
</head>
<body>
test
</body>
</html>";
mail($to, $titulo, $mensagem,"From:$sender\r\nReply-to:$reply\r\nContent-type: text/html; charset=iso-8859-1");
echo "<b><font face='Verdana' color='#C10000' size='2' align='center'>Dados enviados com sucesso.</b></font>";
}
?>
...
`
Answer
Solution:
write
name="emailto[]"
and see the datait's an array of email
Answer
Solution:
As for as I have understood your problem you should work with array. Changed the names of your checkboxes with array like this.
On other hand use loop to get all checked values. Hope it is the answer