I have the form:
<form name="form1" method="post" action="test.php?date=javascript:this.form.date2.value">
I am using a DatetimePicker for PHP like below:
$myCalendar = new tc_calendar("date2");
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d'), date('m'), date('Y'));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(1970, 2020);
$myCalendar->dateAllow('2008-05-13', '2015-03-01', false);
$myCalendar->startMonday(true);
$myCalendar->autoSubmit(true, "form1", "test.php");
$myCalendar->autoSubmit(true, "form1");
$myCalendar->showWeeks(true);
$myCalendar->writeScript();
The thing is i cannot pass the date value from datetimepicker into form action where the url is “test.php?=date=”
How would this be possible to pass the value of datetimepicker by just clicking on calendar, not using any extra button and using onsubmit event.
After execution the result in URL looks like this:
test.php?date=javascript:this.form.date2.value
Thanks
You should not need javascript to submit a form without ajax.
As you want to sent GET variables with ? sign, jsut use GET method in your form and set the name of the input to the name of the variable you want to get sent. (if you can replace ‘date2’ with ‘date’):