Difference between INPUT_GET and INPUT_POST

1.5k Views Asked by At

I have this line of code in my php file where I am have a question regarding the line of code. What would be the difference if I did this to verify my date variable?

Retrieve.php

$firstDate = filter_input(INPUT_GET, 'dtDate', FILTER_SANITIZE_STRING);

AND

$firstDate = filter_input(INPUT_POST, 'dtDate', FILTER_SANITIZE_STRING);

html file

   <form id="siteForm" action="#" name="siteForm">
    <input type="text" name="itemDate" id="itemDate" required>
   </form>
    <input type="submit" class="btn" id='Submit' value="Add" />

I am trying to use the $firstDate variable to compare to a date from the Database, but I need to have the date in an acceptable string format. Would one filter_input option be better than the other?

Mind you I am not using a post or get method in the because I am using a java script file to encode the information. See below:

Js. file

function submit(){
     var formHash =  new Hash();
     $$('#siteForm input, #siteForm textarea, #siteForm input[type=submit]').each(function(el){
         var key = el.getProperty('id');
         var value = el.getPropert('value'.trim());
         formHash.set(key, value);

     });
     processManager.setOptions({
         data: {
             'encFormData': JSON.encode(formHash)
         }
     }).send();
}

Any advice helps.

0

There are 0 best solutions below