PDA

View Full Version : Resolved Help passing value from Jasons Calendar Script



amavadia
12-03-2009, 01:53 PM
1) Script Title:
Jasons Date Input Calendar

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm

3) Describe problem:
I am trying to pass the value from the calendar to a PHP variable using the $_POST, so that I can insert it into a MySQL database, however, it always submits the default value (today). Even after you select the date from the calendar, it still posts the default date. Here are the bits of code I used:

in Header section:


<!-- java script for calendar-->
<script type="text/javascript" src="calendarDateInput.js">

/***********************************************
* Jason's Date Input Calendar- By Jason Moon http://calendar.moonscript.com/dateinput.cfm
* Script featured on and available at http://www.dynamicdrive.com
* Keep this notice intact for use.
***********************************************/

</script>


to call the script:


<td><script>DateInput('startdate', true, 'YYYY-MM-DD')</script></td>
<input type="button" id="startdate" onclick="alert(this.form.startdate.value)" value="Show date value passed">


to retrieve value after submitting form:


$startdate = (isset($_POST['startdate'])) ? ($_POST['startdate']) : '';


Can anyone help? :confused:

Thanks
Amit

MODS please close

amavadia
12-03-2009, 03:31 PM
Just worked it out...
The script creates its own hidden form with the value, I didnt need to create my own!

:)