I´ve made a form which should be able to send me some informations.
On the internet I found a PHP-script that could help me with
that, but it doesn´t work. When you press the Send-button, I recive an email, but it doesn´t have any content. I hope someone can see what is wrong:
Html:
HTML Code:
<form method="post" action="../../php/mail_phpscript.php" enctype="text/plain" name="bestilling">
Hus/værelse:<br>
<input type="text" name="Hus"
value="Det store hus, soveværelset" size="25" readonly="readonly">
<br><br>
Reserverede datoer:<br>
<input type="text" name="datoer" size="25" id="datoer">
<br><br>
Navn/familie:<br>
<input type="text" name="navn" size="20">
<br><br>
Email:<br>
<input type="text" name="email" size="20">
<br><br>
Telefonnummer:<br>
<input type="text" name="fasttlf" size="20">
<br><br>
<input type="submit" value="Send"></form>
PHP:
PHP Code:
<?php
/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$email = 'michaelhoffadamsen@gmail.com';
$subject = 'Email-tilmelding';
$message = $HTTP_POST_VARS['datoer'];
/* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($email,$subject,$message)) {
echo "<center><h1>Informationerne er sendt</h1></center>";
} else {
echo "<h4>Fejl</h4>";
}
?>
All this is uploaded on:
http://www.ullilo.dk/reservering/storehus_sovevaerelse/recieve.html