Advertisement

10.07.2008 at 02:46PM PDT, ID: 23795483
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Date Variable is Changing to 31 Dec 1969

Asked by dannywareham in PHP Scripting Language, JavaScript

Tags:

Hi all

I have a javascript contact form on a php page.
The javascript is used to verify the field entries (which it does fine). the php file handles the creation of the outgoing emai, and formatting into a table layout.

The issue is with two of the fields - a departure and an arrival date.

Regardless of what is submitted through the form, the output is always Wed 31 Dec 1969.
I'm sure that this is something really simple.
Can anyone help, please?

Thanks

(the file is below)Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
<?php
 
$ref = $_SERVER['HTTP_REFERER'];
 
$ar="";
 
$dep ="";
 
if(preg_match("(agneswaters.net.au\/agneswater_enquiries\/index.php)",$ref)){
 
extract($_POST);
 
$er[100];
 
 
 
if ($FName!=''){
 
if(!preg_match("/^[a-zA-Z]+$/",$FName)){
 
$er[]="Please use only alpha characters in First Name ";
 
}
 
}else{
 
$er[]="First Name is required";
 
}
 
 
 
if ($LName!=''){
 
if(!preg_match("/^[a-zA-Z]+$/",$LName)){
 
$er[]="Please use only alpha characters in Last Name ";
 
}
 
}
 
	
 
$ar = $ArrMM  . "/" . $ArrDD . "/" . $ArrYY;
 
$dep = $DepMM . "/" . $DepDD  . "/" . $DepYY;
 
$ar =date('m/d/Y',strtotime($ar));
 
$dep =date('m/d/Y',strtotime($dep));
 
if ($dep<=$ar){
 
$er[]="Departure date must be after arrival date";
 
}
 
 
 
if ($Country!=''){
 
if(!preg_match("/^[a-zA-Z]+$/",$Country)){
 
$er[]="Country is required must only have Alphabets";
 
}}else{
 
$er[]="Country is required";
 
}
 
 
 
 
 
if ($email!=''){
 
if(!preg_match("/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/",$email)){
 
$er[]="Please enter valid email";
 
}
 
}else{
 
$er[]="Email is required";
 
}
 
 
 
if ($Phone!=''){
 
if(!preg_match("/^\d+$/",$Phone)){
 
$er[]="Phone Number must not contain alpha characters";
 
}
 
}
 
else{
 
$er[]="Phone Number is required";
 
}
 
 
 
 
 
if ($MPhone!=''){
 
if(!preg_match("/^\d+$/",$MPhone)){
 
$er[]="Mobile Number must not contain alpha characters";
 
}
 
}
 
$add = trim(strip_tags($AddInf));
 
if ($add!=''){
 
if(preg_match("(http:|ftp|http:\/\/|https:\/\/|www.|.com|.net)",$add)){
 
$er[]="Comment / Feedback must not contain URL or any other HTML Tag";
 
}
 
}
 
if ($captcha==''){
 
$er[]="Security Code is required";
 
}elseif ($captcha!=''){
 
if ($captcha!=$cap2){
 
$er[]="Please enter correct Security code";
 
}
 
}
 
 
 
if (count($er)>0){
 
echo "Please Correct the following Errors<br><ul>";
 
foreach ($er as $e){
 
echo "<li>$e</li>";
 
}
 
echo "</ul>";
 
exit;
 
}else{
 
$msg='<style>
 
.stl td{
 
font-family:Arial, Helvetica, sans-serif;
 
font-size:12px;
 
background-color:#F4F4F4;
 
}
 
</style>
 
           <table width="703" border="0" align="center" cellpadding="3" cellspacing="2" class="stl">
 
  <tr>
 
    <td colspan="4" style="background-color:#999999;"><strong>Enquiry From Website </strong></td>
 
  </tr>
 
  <tr>
 
    <td width="132" >First Name </td>
 
    <td width="222" >' . $_POST['FName'] . '</td>
 
    <td width="118" >Last Name </td>
 
    <td width="197" >' . $_POST['LName'] . '</td>
 
  </tr>
 
  <tr>
 
    <td >Town</td>
 
    <td >' . $_POST['Town'] . '</td>
 
    <td >Country</td>
 
    <td >' . $_POST['Country'] . '</td>
 
  </tr>
 
  <tr>
 
    <td >Arriving Date </td>
 
    <td >' . date("D d, M Y",strtotime($ar)) . ' </td>
 
    <td >Departing</td>
 
    <td >' . date("D d, M Y",strtotime($dep))  . ' </td>
 
  </tr>
 
  <tr>
 
    <td >Number of Persons </td>
 
    <td >' . $_POST['NumPers'] . '</td>
 
    <td >Email</td>
 
    <td >' . $_POST['email'] . '</td>
 
  </tr>
 
  <tr>
 
    <td >Phone Number </td>
 
    <td >' . $_POST['Phone'] . '</td>
 
    <td >Mobile Number </td>
 
    <td >' . $_POST['MPhone'] . '</td>
 
  </tr>
 
  <tr>
 
    <td colspan="4" >Additional Information or Question </td>
 
  </tr>
 
  <tr>
 
    <td colspan="4" >' . $_POST['AddInf'] . '</td>
 
  </tr>
 
</table>
 
';
 
$to = 'steve@agneswaters.com.au';
 
$subject = 'Enquiry from Agnes Water Website';
 
$headers .= 'From: Agnes Water Website <steve@agneswaters.com.au>' . "\r\n";
 
$headers .= 'MIME-Version: 1.0' . "\r\n";
 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
mail($to, $subject, $msg, $headers);
 
header("Location:http://www.agneswater.net.au/agneswater_enquiries/success.php");
 
}
 
}else{
 
//echo 'dont be too smart <br> dont call it directly';
$msg='<style>
 
.stl td{
 
font-family:Arial, Helvetica, sans-serif;
 
font-size:12px;
 
background-color:#F4F4F4;
 
}
 
</style>
 
           <table width="703" border="0" align="center" cellpadding="3" cellspacing="2" class="stl">
 
  <tr>
 
    <td colspan="4" style="background-color:#999999;"><strong>Enquiry From Website </strong></td>
 
  </tr>
 
  <tr>
 
    <td width="132" >First Name </td>
 
    <td width="222" >' . $_POST['FName'] . '</td>
 
    <td width="118" >Last Name </td>
 
    <td width="197" >' . $_POST['LName'] . '</td>
 
  </tr>
 
  <tr>
 
    <td >Town</td>
 
    <td >' . $_POST['Town'] . '</td>
 
    <td >Country</td>
 
    <td >' . $_POST['Country'] . '</td>
 
  </tr>
 
  <tr>
 
    <td >Arriving Date </td>
 
    <td >' . date("D d, M Y",strtotime($ar)) . ' </td>
 
    <td >Departing</td>
 
    <td >' . date("D d, M Y",strtotime($dep))  . ' </td>
 
  </tr>
 
  <tr>
 
    <td >Number of Persons </td>
 
    <td >' . $_POST['NumPers'] . '</td>
 
    <td >Email</td>
 
    <td >' . $_POST['email'] . '</td>
 
  </tr>
 
  <tr>
 
    <td >Phone Number </td>
 
    <td >' . $_POST['Phone'] . '</td>
 
    <td >Mobile Number </td>
 
    <td >' . $_POST['MPhone'] . '</td>
 
  </tr>
 
  <tr>
 
    <td colspan="4" >Additional Information or Question </td>
 
  </tr>
 
  <tr>
 
    <td colspan="4" >' . $_POST['AddInf'] . '</td>
 
  </tr>
 
</table>
 
';
 
//$to = 'steve@agneswaters.com.au';
 
$to = 'danny@datamouse.biz';
 
$subject = 'Enquiry from Agnes Water Website';
 
$headers .= 'From: Agnes Water Website <steve@agneswaters.com.au>' . "\r\n";
 
$headers .= 'MIME-Version: 1.0' . "\r\n";
 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
mail($to, $subject, $msg, $headers);
 
header("Location:http://www.agneswater.net.au/agneswater_enquiries/success.php");
 
}
 
?>
[+][-]10.07.2008 at 03:05PM PDT, ID: 22664364

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.07.2008 at 03:52PM PDT, ID: 22664685

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.07.2008 at 04:21PM PDT, ID: 22664825

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, JavaScript
Tags: PHP
Sign Up Now!
Solution Provided By: youssefomar
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628