|
||||||
| Forums FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Hi All,
I'm probably missing something really silly but how to I get the date picked using JQuery's Datepicker (UI/API/1.7.1/Datepicker - jQuery JavaScript Library) into a variable I can use in a PHP script? I can't seem to figure out what to pull out of $_REGISTERS OR $_POST. Thanks in advance. kev. |
|
|||
|
Javascript date pickers (and other kinds of client side pickers) work by assigning the output to a field in the form that you specify. This would be a field that would be normally typed in by hand. If you do not want users to be able to change that form field by typing, then make it readonly. So the user sees that the datepicker has "filled in" the field for them when a date is clicked on.
You then process the form as normal. Nothing PHP specific either, works with any other server-side technology. |
|
|||
|
Hi kev,
here's an example to assign the output to a field, as mentioned in the previous post, Code:
<!DOCTYPE html>
<html>
<head>
<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.3.2.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.datepicker.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#datepicker").datepicker({
onSelect: function(dateText, inst) { alert(dateText);document.getElementById('thedate').value=dateText; }
}
);
});
</script>
</head>
<body style="font-size:62.5%;">
<div type="text" id="datepicker"></div>
<form method=post>
<input type='text' id='thedate' name='thedate' />
</form>
</body>
</html>
HTH
__________________
"And just as you want men to do to you, you also do to them likewise." Luke 6:31 NKJV |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|