We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Question on using a Date picker in Javascript

akohan
akohan asked
on
Medium Priority
249 Views
Last Modified: 2012-05-06
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

Comment
Watch Question

Ionut A. TudorPHP Programmer
CERTIFIED EXPERT

Commented:
in your php file `myfile.php`  you can access the date like this:
$mydate = $_POST['calendar1b'];
print $mydate;

Author

Commented:

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

Thanks.
PHP Programmer
CERTIFIED EXPERT
Commented:
I tested in my local machine and its ok. Can you show us the output of
print_r($_POST);

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:

NO output just a blank page!
Ionut A. TudorPHP Programmer
CERTIFIED EXPERT

Commented:
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 ( )

Author

Commented:


Thanks indeed!

Author

Commented:

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

Thanks again.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.