Two datepickers, one loads saved date, the other does not

Two datepickers, one loads saved date, the other does not

I have two date pickers on my page, a begin date and an end date.  I want the date selected in each to re-load from the $_POST variable after submit if there was a problem submitting the form.  Strangely, it works perfectly in the first datepicker input, but not in the second.  Why not?

  1. <input class="-hidden datepicker" name="datepicker_b" type="text" id="datepicker_b" value="<?php if (isset($_POST['datepicker_b'])) {echo $_POST['datepicker_b'];} ?>" />
  2. <input class="-hidden datepicker" name="datepicker_e" type="text" id="datepicker_e" value"<?php if (isset($_POST['datepicker_e'])) {echo $_POST['datepicker_e'];} ?>" />

I have a nearly identical problem in my EDIT page.  The selected record should load the dates saved in the database table, and it does, but only in the begin date input, the end date input is empty.

  1. <input class="-hidden datepicker" name="datepicker_b" type="text" id="datepicker_b" value="<?php echo (isset($_POST['datepicker_b']) && (!empty($_POST['datepicker_b']))) ? $_POST['datepicker_b'] : $dateb ?>" />
  2. <input class="-hidden datepicker" name="datepicker_e" type="text" id="datepicker_e" value"<?php echo (isset($_POST['datepicker_e']) && (!empty($_POST['datepicker_e']))) ? $_POST['datepicker_e'] : $datee ?>" />

I know that the variables containing the saved dates ($dateb, $datee) are correct, because I have them echoed on the page while troubleshooting.

Here is my call:

  1.  $(function() {
      $( ".datepicker" ).datepicker({
      showOn: "button",
      buttonImage: "../scripts/jquery-ui-1.9.2.custom/development-bundle/demos/datepicker/images/calendar.gif",
      buttonImageOnly: true,
      dateFormat: "yy-mm-dd"
      });
      });







Can someone explain why only the first instance of datepicker is able to load the date from either the $_POST variable or a variable containing the record field?

TIA