title: How to show a date a user picked with php?
body: <p>I'm making a restaurant website for a school project and my group thought it would be cool to do online reservations. For the online reservation, we wanted it to be like a form where they input their name, pick the date and time, and submit the form and the success page will show them the date and time for their reservation. Like a "Thank you _____, your reservation is set for DATE at Time". I was able to accomplish this with PHP, I made a form</p>
  
  <pre><code>&lt;form action= "reservation_post.php" method="post"&gt;
  
    &lt;div class="resNames"&gt;
  
      &lt;div class = "resFlexGroup"&gt;
        &lt;label class="resTitle"&gt;First Name&lt;/label&gt;
        &lt;input type="text" name="fName" class="resHalf"&gt;
      &lt;/div&gt;
  
      &lt;div class = "resFlexGroup"&gt;
        &lt;label class="resTitle"&gt;Last Name&lt;/label&gt;
        &lt;input type="text" name="lName" class="resHalf"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;div class="resSizeDateTime resRow"&gt;
  
      &lt;div class=" flexSmallThird"&gt;
        &lt;label class="resTitle"&gt;Party Size&lt;/label&gt;
        &lt;select class="partySize" name="partySize"&gt;
          &lt;option value="1"&gt;1&lt;/option&gt;
          &lt;option value="2"&gt;2&lt;/option&gt;
          &lt;option value="3"&gt;3&lt;/option&gt;
          &lt;option value="4"&gt;4&lt;/option&gt;
          &lt;option value="5"&gt;5&lt;/option&gt;
          &lt;option value="6"&gt;6&lt;/option&gt;
          &lt;option value="7"&gt;7&lt;/option&gt;
          &lt;option value="8"&gt;8&lt;/option&gt;
          &lt;option value="9"&gt;9&lt;/option&gt;
         &lt;/select&gt;
       &lt;/div&gt;
  
  
      &lt;div class = "flexThird"&gt;
        &lt;label class="resTitle"&gt;Reservation Date&lt;/label&gt;
        &lt;input type="text" name="datepicker" id="datepicker"&gt;
      &lt;/div&gt;
  
  
  
        &lt;div class="flexThird"&gt;
        &lt;label class="resTitle"&gt;Reservation Time&lt;/label&gt;
        &lt;select id="partySize" name="resTime" class="resHalf"&gt;
          &lt;option value="1:00 PM"&gt;1&lt;/option&gt;
          &lt;option value="2: 00 PM"&gt;2&lt;/option&gt;
          &lt;option value="partyThree"&gt;3&lt;/option&gt;
          &lt;option value="partyFour"&gt;4&lt;/option&gt;
          &lt;option value="partyFive"&gt;5&lt;/option&gt;
          &lt;option value="partySix"&gt;6&lt;/option&gt;
          &lt;option value="partySeven"&gt;7&lt;/option&gt;
          &lt;option value="partyEight"&gt;8&lt;/option&gt;
          &lt;option value="partyNine"&gt;9&lt;/option&gt;
          &lt;option value="partyTen"&gt;10&lt;/option&gt;
         &lt;/select&gt;
       &lt;/div&gt;
  
  &lt;/div&gt;
  
    &lt;div class="resAccess resRow"&gt;
      &lt;input type="checkbox" name="access" class="checkAccess"&gt; &lt;label class="resTitle"&gt;Need Accessable Seating?&lt;/label&gt;
    &lt;/div&gt;
  
      &lt;div id="yesAccess"&gt;
        &lt;label class="resTitle"&gt;How many in party?&lt;/label&gt;
        &lt;select class="partySize" name="partyAccess"&gt;
           &lt;option value="partyOne"&gt;1&lt;/option&gt;
           &lt;option value="partyTwo"&gt;2&lt;/option&gt;
           &lt;option value="partyThree"&gt;3&lt;/option&gt;
           &lt;option value="partyFour"&gt;4&lt;/option&gt;
           &lt;option value="partyFive"&gt;5&lt;/option&gt;
           &lt;option value="partySix"&gt;6&lt;/option&gt;
           &lt;option value="partySeven"&gt;7&lt;/option&gt;
           &lt;option value="partyEight"&gt;8&lt;/option&gt;
           &lt;option value="partyNine"&gt;9&lt;/option&gt;
           &lt;/select&gt;
         &lt;/div&gt;
                   &lt;div class="submit-button"&gt;
      &lt;input type="Submit" name="SubmitThis" value="Submit" class="submit-btn"&gt;
                  &lt;/div&gt;
     &lt;/form&gt;
  </code></pre>
  
  <p>That's the code I have for the form.</p>
  
  <pre><code>&lt;?php
  include ('components.php');
  $fName = $_POST['fName'];
  $lNamee = $_POST['lName'];
  $partySize = $_POST['partySize'];
  $date = $_POST['var'];
  $time = $_POST['resTime'];
  $checkbox = $_POST['access'];
  $bgcolor = $_POST['partyAccess'];
  
  $permitted_chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  $code = substr(str_shuffle($permitted_chars), 0, 5);
  
  $output="&lt;p&gt;Thank you &lt;span class='resEmphasis'&gt;$fName&lt;/span&gt;, we'll have a table ready for your party of &lt;span class='resEmphasis'&gt;$partySize&lt;/span&gt; at &lt;span class='resEmphasis'&gt;$time&lt;/span&gt; on &lt;span class='resEmphasis'&gt;$date&lt;/span&gt;. &lt;/p&gt; &lt;p&gt;Your code is:&lt;/p&gt;&lt;span id='resCode'&gt;$code&lt;/span&gt; &lt;p&gt;Show this code to the host to check in.&lt;/p&gt;";
  
  ?&gt;
  </code></pre>
  
  <p>This is the code I have to call on the user input.</p>
  
  <p>(Sorry for all the divs and such i used it for CSS. Also it's pretty incomplete so I know the time is wrong.) </p>
  
  <p>For the date, I was able to get it to work when I used the HTML date input, but when I called the function on the other page it was formatted like "2020-04-03", which I found very ugly and not very user friendly. I read that there was no way to reformat it, so I decided to download the JQuery UI datepicker. I personally found it to be more aesthetically pleasing, but now I had no idea how to call on the function and show it to the user. 
  Also when I was calling on the date picker I also tried using datepicker instead of var but i still had no results.
  I think what i have to do is somehow get the selected value from the jquery part but I don't know how to do that ): </p>
  
  <p>It's just for a school project so if I have to resort back to the HTML input I will but it's so ugly and I really don't want to do that. Also if there's a way to do that with the time I would rather do that too, I just made it a dropdown menu so I could format it to look more user friendly in the post form.</p>