I have a input text in the form for date and i use JQuery datepicker to select date.
<input type="text" id="datepicker" name="datepicker" value="Date"/>
when i use form post to post the values into another php for calculation. i don't get the values from this input text alone. i get an empty value instead of selected date.
$date=$_POST['datepicker'];
i'm not sure of how to pass the datepicker value in form POST. Can someone help me out?
jQuery's datepicker has nothing to do with posting your form. If your form is set to "post" then whatever is left in that input field after the user has selected a date will be sent with the form.
<form action="process.php" method="post">
<input type="text" id="datepicker" name="datepicker" value="Date"/>
</form>
Gives you:
$date = $_POST['datepicker'];
However if your form is being sent as a "get" request you'll need to access it as such.
<form action="process.php" method="get">
<input type="text" id="datepicker" name="datepicker" value="Date"/>
</form>
Gives you:
$date = $_GET['datepicker'];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With