Hi,
I followed this tutorial here http://www.plus2net.com/php_tutorial/date-selection.php and it worked fine and I managed to add it to my form. It all posts ok until i decided that i needed two seperate dates. So I copied and pasted the table data with the form which has one submit button at the bottom of the tables. The problem is that only the second table (the second drop down box dates) actually submits to my email. The first set of dates don’t show up at all. (The name and email address all works ok). Anyone got any ideas. I’m a complete php newby…so go easy
[php]<?php
if (isset($_POST[‘contact_name’]) && isset($_POST[‘contact_email’]) && isset ($_POST[‘contact_text’])) {
$contact_name = $_POST[‘contact_name’];
$contact_email = $_POST[‘contact_email’];
$contact_text = $_POST[‘contact_text’];
$todo=$_POST['todo'];
if(isset($todo) and $todo==“submit”){
$dt=$_POST['dt'];
$month=$_POST['month'];
$year=$_POST['year'];
$date_value="$dt/$month/$year";
}
if (!empty ($contact_name) && !empty ($contact_email) && !empty ($contact_text)) {
if (strlen($contact_name)>30 || strlen($contact_email)>50 || strlen($contact_text)>1000) {
echo ‘Sorry maxlength for some field has been exceeded.’;
} else {
$to = '[email protected]';
$subject = 'Holiday dates form submitted.';
$body = $contact_name. "\n". $contact_text. "\n". $date_value;
$headers = 'From:' .$contact_email;
if (@mail($to, $subject, $body, $headers)) {
echo 'Thanks for contacting us. We\'ll be in touch soon.';
} else {
echo 'Sorry, an error has occurred. Please try again later, or alternatively send us an email.';
}
}
} else {
echo 'All fields are required.';
}
}
?>[/php]
and the form code below:
[code]
Name:
Email address:
Message:
<input type="hidden" name="todo" value="submit">
Select Month January February March April May June July August September October November December | Date 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | Select Year 2012 2013 |
Select Month January February March April May June July August September October November December | Date 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
Select Year
2012
2013
|
Thats it!!
Louise