I'm trying to make a form that takes name, email and message and sends it to me.
I have this form:
<form id="form" action="form.php" method="post" enctype="text/plain">
Namn:<br>
<input id="box1" type="text" name="name"><br>
E-post:<br>
<input id="box2" type="text" name="mail"><br>
Meddelande:<br>
<textarea id="messagebox" type="text" name="message"></textarea><br><br>
<input id="submit" type="submit" value="Send">
</form>
This is my form.php:
<?PHP
$name = $_POST["name"];
$mail = $_POST["mail"];
$message = $_POST["message"];
mail("name@example.com", "Message from $name", $message);
?>
I do receive an email but it does not have the subject or message. It says the mail is empty. If I replace the variables with text in the mail function I get that correct text, which must means the variables don't get their values.
Is this the case and how should I solve it? If not, what else could be wrong?