Group Admins

  • Profile picture of Steve

WordPress Troubleshooting and Support

Public Group active 4 months, 3 weeks ago ago

WordPress support from our community

Put date picker into page that lets me change page display

This topic contains 1 reply, has 1 voice, and was last updated by  Margarete Koenen 5 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2993

    Margarete Koenen
    Participant

    I am creating charts based on data provided by previously created Gravity form entries into pages.

    Now I want to allow the user to limit the information displayed. So I added input fields to the template and a jQuery datepicker. This all works, but I can’t figure out how to catch the user input.

    My jQuery is very simple:

    jQuery(document).ready(function($) {
    
        $("#startdate").datepicker({
      			changeMonth: true,
      			changeYear: true,
      			dateFormat : "yy-mm-dd",
        });
    
        $("#enddate").datepicker({
      			changeMonth: true,
      			changeYear: true,
      			dateFormat : "yy-mm-dd",
        });
    
    });

    In my template file I have the following

    <form action="page-experiment.php" method="post">
    
          <p>Select Start Date</p> 
          <input type="text" id="startdate" name="startdate" />
        
          <p>Select End Date</p>
          <input type="text" id="enddate" name="enddate" />
    
          <input type="submit" id="submit" name="submit" value="Submit" />
        </form>
      </div>
    
      
      <?php
      $start_date = $_POST['startdate']; 
      var_dump($start_date);
      
      $end_date = $_POST['enddate']; 
      var_dump($enddate);
    
      ?>

    I tried variations of the action url but nothing seems to work. On submit I get a “nothing found” message.

    I have spent a few hours on this and searched the internet but have not found any answers. I would really appreciate any help you could give.

    #2994

    Margarete Koenen
    Participant

    I figured it out. “action” has to be empty. So it looks like this:

    <form action="" method="post">

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.