title: variable variables within $_POST and associative arrays
body: <p>I'm probably being a little thick, but I can't seem to find an answer to this one. I'm moving from a server with register globals ON to one with it being off. It's a good thing, but unfortunately I have been used to years and years working with register globals being ON which has resulted in me writing sloppy code. I am now trying to fix that.</p>
  
  <p>I'm trying to rewrite some old code which has variable variables within $_POST.</p>
  
  <p>I know this is a silly example, but it illustrates the problem I am trying to solve. The following would work with register globals ON:</p>
  
  <pre><code>&lt;?php $variable = "fullname";?&gt;
  &lt;form action="/test/" method="post"&gt;
  &lt;label for="fullname"&gt;Full Name:&lt;/label&gt; &lt;input name="fullname" type="text" value="&lt;?php echo $$variable;?&gt;" size="20" maxlength="150" /&gt;
  &lt;input name="submit" type="submit" value="Go!" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>How do I make this work with register globals off? The following obviously doesn't work:</p>
  
  <pre><code>&lt;?php $variable = "fullname";?&gt;
  &lt;form action="/test/" method="post"&gt;
  &lt;label for="fullname"&gt;Full Name:&lt;/label&gt; &lt;input name="fullname" type="text" value="&lt;?php echo $_POST[$$variable];?&gt;" size="20" maxlength="150" /&gt;
  &lt;input name="submit" type="submit" value="Go!" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Please go easy on me- I know I am probably being stupid, but I can't seem to get my head round this. </p>