Php form not submit
When I submit my form, it dies for no apparent reason.
My form code:
<form action="mail.php" method="post">
<input class="invoeren" name="naamUser" type="text" placeholder="Naam" required>
<input class="invoeren" name="nummerUser" type="text" placeholder="Telefoonnummer" required>
<input class="invoeren" name="onderwerpUser" type="text" placeholder="Onderwerp" required>
<textarea class="invoeren" type="text" name="opmerkingUser" placeholder="Opmerking" required></textarea>
<button type="submit" id="contactButton">Verstuur</button>
</form>
My mail.php file:
<?php
ob_start();
$naamUser = $_POST['naamUser'];
$nummerUser = $_POST['nummerUser'];
$onderwerpUser = $_POST['onderwerpUser'];
$opmerkingUser = $_POST['opmerkingUser'];
$formcontent="Aanvraag formulier Domein naam \n
Naam: $naamUser \n
Telefoonnummer: $nummerUser \n
Onderwerp: $onderwerpUser \n
Opmerking: $opmerkingUser \n
";
$recipient = "email@email.nl";
$subject = "Terug Bellen";
$mailheader = "From: $naamUser \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
?>
I am using 1 mail.php file for multiple index.html files, maybe the reason it dies?
"Can you answer this question with your comment? @ Fred-ii- Because the answer, thanks! - Blank"
As requested by the OP:
From:
expects an email address, not a name.
- Check your spam.
Read the manual mail()
- http://php.net/manual/en/function.mail.php
and one more comment:
Add an error report to the beginning of the file (s) right after opening the PHP tag eg
<?php error_reporting(E_ALL); ini_set('display_errors', 1);
and then the rest of your code to see if it gives you something and make sure you have access to mail()
and that PHP is actually working as expected.