Which of the two is recommended way of passing variable php?
<p>I want to pass a variable from one page to another. It may carry some sensitive data so focus remains on security. I have come through two ways</p>

<p>HTML-form:</p>

<pre><code>&lt;form action="target.php" method="post"&gt;
&lt;input type="text" name="key" value="foo" /&gt;
&lt;input type="submit" value="submit" /&gt;
&lt;/form&gt;
</code></pre>

<p>PHP:</p>

<pre><code>$context = stream_context_create(array(
'http' =&gt; array(
  'method'  =&gt; 'POST',
  'header'  =&gt; "Content-type: text/html\r\n",
  'content' =&gt; http_build_query(array('key' =&gt; 'foo'))
),
));
$return = file_get_contents('target.php', false, $context);
</code></pre>

<p>Which is more safer of the two? Any other method welcomed.</p>