This is pretty basic, but I'm new to web development. I have a form in HTML that takes time and passed it to a variable in PHP script. That works fine. However, I try to now take the date from the user in HTML, and pass it the same way to a variable in PHP and I get nothing (print shows that the variable is empty).
Here is my code:
<form action="" method="post"> <select name="time"> <!-- some values here --> </select> <input type="text" id="datepicker"> <input type="submit"> </form> <?php $search = $_POST['time']; // it prints data print($_POST['time']); // it prints none $search2 = $_POST['datepicker']; print($search2); ?> The first print ($search) does print out the time selected by the user. However, the second print ($search2) does not print out the date selected. Where did I go wrong?
nameattribute to your datepicker textbox because you have one in your time select