title: Using POST method to hide URL parameters
body: <p>I understand that I am able to use the POST method for URL parameters to display data according to a specific variable, I know how to make use of the GET method - but I am told that the POST method can be used to hide the part of the URL that is like this.</p>
  
  <pre><code>/data.php?parameter=1234
  </code></pre>
  
  <p>What is the actual difference of the two methods in terms of URL parameters?</p>
  
  <p>Below is some code that fetches data from a database according to the id of a specific link</p>
  
  <pre><code>    &lt;?php
  //This includes the variables, adjusted within the 'config.php file' and the functions from the 'functions.php' - the config variables are adjusted prior to anything else.
  require('configs/config.php');
  require('configs/functions.php');
  
      //This is the actual interaction with the database, according to the id.
      $query = mysql_query("SELECT * FROM table WHERE id=" .$_GET['id'] . ";") or die("An error has occurred");
  
              //This re-directs to an error page the user preventing them from viewing the page if there are no rows with data equal to the query.
      if( mysql_num_rows($query) &lt; 1 )
  {
    header('Location: 404.php');
    exit;
  }
  
      //Here each cell in the database is fetched and assigned a variable.
      while($row = mysql_fetch_array($query))
      {
          $id = $row['id'];
          $title = $row['title'];
          $month = $row['month'];
          $day = $row['day'];
          $photo = $row['photo'];
          $text = $row['text'];    
      }
  ?&gt;
  </code></pre>
  
  <p>On a separate page I generate links to the data.php file according to the ID like so:</p>
  
  <pre><code>&lt;a href="post.php?id=&lt;?php echo $content['id']; ?&gt;"&gt;&lt;?php echo $content['title']; ?&gt;&lt;/a&gt;
  </code></pre>
  
  <p>Forgetting that there are potential SQL injections that can occur through the above code, how would I go about making use of the POST method in order to hide the URL parameters, or at least not display them like this:</p>
  
  <pre><code>http://example.com/data.php?id=1
  </code></pre>