This question already has an answer here:
I have made a PHP checkbox form, which should send me an email with the chosen options and the text from the textarea field. The problem is that I am a novice in PHP checkbox forms (this is my first attempt to try something like this), and it gives me some errors when hitting submit button. I have xampp installed and the servers are active, the *.php is in the htdocs, so it isn't because of these things. Hope you can help me. <?php $to = "[my real email]"; $subject = "Shop request:"; ; $language = $_REQUEST['i'] ; $message = $_REQUEST['message'] ; $details = "Subject: $subject\n Item: $i \n Message: $message \n "; ini_set("sendmail_from", $email); $ok = mail($to, $subject, $message); if ($ok) { echo "<p>Mail sent!</p>"; } else { echo "<p>Mail could not be sent. Sorry!</p>"; } ?>
<form action="http://localhost/contactus.php" method="post" enctype="multipart/form-data">
<br>
<table width="58%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="1" align="left" valign="middle">Items:</td>
<td align="left">
<input type="checkbox" name="i[]" value="B1">B1
<input type="checkbox" name="i[]" value="B2">B2
<input type="checkbox" name="i[]" value="B3">B3 </td>
</tr>
<tr>
<td height="40" align="left" valign="middle">Adress:</td>
<td align="left"><label for="message"></label>
<textarea name="message" id="message" cols="45" rows="5"></textarea></td>
</tr>
<tr>
<td height="40" align="left"> </td>
<td align="left"><input type="submit" value="Send" /> </tr>
</table>
</form>
Aucun commentaire:
Enregistrer un commentaire