[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

Question on using a Date picker in Javascript

Hello group,

I found a Date-picker control as datepickercontrol (http://dali.mty.itesm.mx/~hugo/js/datepickercontrol/) and have the following page which works fine but the problem is that it doesn't post the date value to the PHP file (action) I have used in form.

I'm not very familiar with java script so your help will be a big help.

Regards,
ak

///
 
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <meta name="GENERATOR" content="Quanta Plus">
  <script type="text/javascript" src="datepickercontrol.js"></script>
  <script language="JavaScript">
     if (navigator.platform.toString().toLowerCase().indexOf("linux") != -1){
	 	document.write('<link type="text/css" rel="stylesheet" href="datepickercontrol_lnx.css">');
	 }
	 else{
	 	document.write('<link type="text/css" rel="stylesheet" href="datepickercontrol.css">');
	 }
  </script>
  <link type="text/css" rel="stylesheet" href="content.css">
  <title>Perfect Attendance</title>
 
 
</head>
<body>
<form action="myfile.php" method="post">
<table width="90%" border="0" align="center">
  <tr>
    <td width="20%">Testing </td>
    <td width="60%" align="center"><h1>title goes here</h1></td>
    <td width="20%">&nbsp;</td>
  </tr>
  <tr>
    <td colspan=3 align="center"><h4>Please Enter a Date Range.</h4></td>  
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="60%" align="center">
<tr>
<input type="text" id="DPC_calendar1b_YYYY-MM-DD" name="calendar1b" size="12">
<td>Start Date:</td>
<td><input name="from_date" type="text" size="15"></td>
<td>End Date:</td>
<td><input name="to_date" type="text" size="15"></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="60%" align="center">
<tr><td align="center"><input name="Submit" type="submit" value="Submit"></td></tr></table>
<input type="hidden" id="DPC_TODAY_TEXT" value="today">
<input type="hidden" id="DPC_BUTTON_TITLE" value="Open calendar...">
<input type="hidden" id="DPC_MONTH_NAMES" value="['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']">
<input type="hidden" id="DPC_DAY_NAMES" value="['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']">
</form>
 
 
</body>
</html>

Open in new window

0
akohan
Asked:
akohan
  • 4
  • 3
1 Solution
 
Ionut A. TudorPHP ProgrammerCommented:
in your php file `myfile.php`  you can access the date like this:
$mydate = $_POST['calendar1b'];
print $mydate;
0
 
akohanAuthor Commented:

Yes, I had tried but doesn't show anything.

Thanks.
0
 
Ionut A. TudorPHP ProgrammerCommented:
I tested in my local machine and its ok. Can you show us the output of
print_r($_POST);
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
akohanAuthor Commented:

NO output just a blank page!
0
 
Ionut A. TudorPHP ProgrammerCommented:
you should try and see if php is working for you,
<?php
phpinfo();
?>
Does it output anything ? if yes put print_r($_POST) and it should at least output an empty array like this: Array ( )
0
 
akohanAuthor Commented:


Thanks indeed!
0
 
akohanAuthor Commented:

I had some issues in my html/javascript part but it works just fine.

Thanks again.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now