JQuery Date Picker not emailing PHP Mail script
Hi,
I wonder if anyone can help me. I am building a few forms and one of them requires a date, I am using the date picker however the dates are not being emailed. I am using PHP for the form and the mail script. Heres the code for my test form -
Contact Form PHP
- <!doctype html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>jQuery UI Datepicker - Default functionality</title>
- <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
- <link rel="stylesheet" href="/resources/demos/style.css">
- <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
- <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
- <script>
- $( function() {
- $( "#datepicker" ).datepicker();
- } ); </script>
- <style type="text/css">
- #FormDiv {
- width: 400px;
- height: auto;
- margin-left: auto;
- margin-right: auto;
- margin-top: 60px;
- background: #8D8D8D;
- text-align: left;
- padding-bottom: 6px;
- padding-top: 6px;
- padding-left: 6PX;
- padding-right: 6px;
- }
-
- #Message {
- width: 390px;
- height: 300px;
- }
-
- </style>
- </head>
- <body>
- <div id="FormDiv"><form action="mailscript.php" method="post" id="ContactForm"><table border="0">
- <tbody>
- <tr>
- <td><label for="Subject">Subject:</label>
- <input type="text" name="Subject" id="Subject"></td>
- </tr>
- <tr>
- <td><label for="Email">*Email:</label>
- <input type="email" name="Email" required="required" id="Email"></td>
- </tr>
- <tr>
- <td><label for="textarea">*Message:</label>
- <textarea name="Message" required="required" id="Message"></textarea></td>
- </tr>
- <tr>
- <td><label for="datepicker">Date:</label> <input type="text" name="datepicker" id="datepicker"></p></td>
- </tr>
- <tr>
- <td><input type="submit" name="submitButton" id="submitButton" value="Send Message"></td>
- </tr>
- <tr>
- <td> </td>
- </tr>
- </tbody>
- </table>
- </form>
-
-
- </div>
- </body>
- </html>
Mail Script PHP
- <?php
- $from=$_POST['Email'];
- $email="cameron.nicholson96@gmail.com";
- $subject=$_POST['Subject'];
- $message=$_POST['Message'];
- $date=$_POST['datepicker'];
- mail( $email, $subject, $message, $date, "From:".$from);
- Print "Your Message Has Been Sent";
*NOTE*: With this current mail script code, specifically $date in line 10, no emails are received at all.
Any advice would be greatly appreciated.
Thanks