I am absolutely bad at PHP programming. I have no experience with it, but I wanted a form on my website with a mail script. So like almost every other person with no experience on a language, I googled up one and customized it.
mail_send.php
<?php
if(isset($_POST['submit'])){
$to = "my@mailadress.com"; // I just did this for privacy
$from = $_POST['email'];
$name = $_POST['name'];
$subject = "Form submission";
$message = $name . " " . $from . " wrote the following:" . "\n\n" .
$_POST['message'];
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent. Thank you " . $name . ", we will contact you shortly.";
}
?>
and here the HTML code: index.html
<form role="form" id="feedbackForm" class="text-center" action="mail_send.php" method="post">
<div class="form-group">
<label for="name">Naam</label>
<input type="text" class="form-control" id="name" name="name" placeholder="Name">
<span class="help-block" style="display: none;">Voer uw naam in..</span></div>
<div class="form-group">
<label for="email">E-Mail</label>
<input type="email" class="form-control" id="email" name="email" placeholder="Email Address">
<span class="help-block" style="display: none;">Voer een geldig e-mailadres in.</span></div>
<div class="form-group">
<label for="message">Bericht</label>
<textarea rows="10" cols="100" class="form-control" id="message" name="message" placeholder="Message"></textarea>
<span class="help-block" style="display: none;">Voer een bericht in.</span></div>
<button type="submit" id="feedbackSubmit" class="btn btn-primary btn-lg" style=" margin-top: 10px;"> Verstuur</button>
</form>
So I have uploaded both files to my Website Server so I've tested it online, but still without success. Any smart guys being able to help me?
Thanks in advance :)