I am trying to setup this mail script. You can view the form at this page barbarajyoungman.com/Matilda/info.html. Basically, I cant get it to send me all the form values including the calendar date. And, it says I can have more than 5 var so I cant even try to send the time or add a "party size". What can I do ? Also, I can't figure out how to send the javascript calendar date without using the OnFocus to update a text box.
Code: Select all
<td>
<form action="mail.php" method="POST">
<br /><input type="text" name="name" size=20>
<br /><input type="text" name="phone" size=20>
<br /><script>DateInput('orderdate', true, 'DD-MON-YYYY')</script><input type="text" onfocus='this.value=this.form.orderdate.value' value="Click to update"name="date">
<br /><input type="text" name="time" size=20>
<br /><input type="reset" value=" Reset "><input type="submit" value=" Send "></form>Code: Select all
<html>
<head><title>PHP Mail Sender</title>
<style type="text/css">
<!--
body {font-family: Arial, Helvetica, sans-serif;
font-size: 12px}
-->
</style>
</head>
<body bgcolor="#CCCCCC">
<?php
$email = 'kalman.evan@gmail.com';
$subject = 'MATILDA RESERVATION';
$name = $HTTP_POST_VARS['name'];
$phone = $HTTP_POST_VARS['phone'];
$date = $HTTP_POST_VARS['date'];
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>";
}
elseif (mail($email,$subject,$name,$phone,$date)) {
echo "<h4>Thank you. I will be in touch soon!</h4>";
} else {
echo "<h4>Can't send email</h4>";
}
?>
?>
</body>
</html>