IF ((isset($_GET... ELSE{$date...}

:’(
I am having a heck of a time… PISSING ME OFF

Initial page renders just fine, echo’s out a default of today’s date…
I have a date picker that should rebuild the page when a date is picked (thats kinda the point of a datepicker) … it puts the date in the URL, but when the page reloads it wont grab the date into the variable.

The Error:
Notice: Undefined variable: date1 in “…appointment-calendar\calendar.html.php” on line 15
Here is the URL:
http://localhost/admin/appointment-calendar/calendar.html.php?date2=2011-11-09

Here is the code:
[php]
index.php

<?php include $_SERVER['DOCUMENT_ROOT'] . '../db.connect.php'; if ((isset ($_GET['date2']))) { $date1 = $_GET['date2']; } else { $date1= DATE("Y-m-d"); } $sql = "SELECT id, date date1, clientid, userid FROM appointments WHERE date = '$date1'"; $result = mysqli_query($link, $sql); if (!$result) { $error = 'Error fetching appointments from database!'; include 'error.html.php'; exit(); } while ($row = mysqli_fetch_array($result)) { $appointments[] = array('id' => $row['id'],'userid' => $row['userid'], 'date1' => $row['date1'] ); }; include 'calendar.html.php'; ?>

calendar.html.php

<?php echo 'selected date' . $date1; ?>

[/php]

I’ve been awake for far too long, I just can’t see my error!
HELP!!! Thanks :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service