I have hit the brick wall. I am running this code on 2 pages.
Code
[php]$selectbegindate = $_POST[‘begindate’];
$selectenddate = $_POST[‘enddate’]; // End date
$begindate = new DateTime($selectbegindate);
$enddate = new DateTime($selectenddate);[/php]
Form:
[php]
Begin Date:
End date:
[/php]
First page: I can submit a begin date and an end date through an HTML form and my page works as expected, running SQL statements, producing charts, etc. My issue comes when I navigate to another page, which does have the same code and html form so the user can submit another date query if needed, I get the following:
Notice: Undefined index: begindate in C:\xampp\htdocs\dashboard\index2.php on line 10
Notice: Undefined index: enddate in C:\xampp\htdocs\dashboard\index2.php on line 11
Line 10 and 11 being the first 2 lines in the first code above.
I’m sure this is an easy fix but I can not, for the life of me, figure it out.
I have tried understanding isset and isempty but not having any luck applying it to what I need. I also read that I need to store the dates in a session. Tried that several different ways to no avail.
Thanks for any help.