title: Using a foreach loop to get create variables from $_POST security issues?
body: <p>In the past I have used the following to create variables from a posted form.</p>
  
  <pre><code>foreach($_POST as $k=&gt;$v)
  {
      $$k = $v;
  }
  </code></pre>
  
  <p>What are the security risks associates with using this method?</p>
  
  <p>im trying some test atm. how about this version where it removes anything that is not a letter or number before making the variable?</p>
  
  <pre><code>foreach($_POST as $k=&gt;$v)
  {
      $k = preg_replace("/[^[:alnum:]]/","",$k);
      $$k=$v;
  }
  </code></pre>