title: Error using variable from one form to another
body: <p>In <code>PHP</code> I would like to use the <code>$num</code> value that is entered in the first form and execute a <code>pow()</code> function with <code>$num</code> and another variable, named <code>$rate</code>, which I enter in the second form.</p>
  
  <pre><code>&lt;body&gt;
  &lt;form action="" method="post"&gt;
      Enter number: &lt;input type="number" name="num" id="num"/&gt;
      &lt;input type="submit" name="next" value="Next"/&gt;&lt;br&gt;
  &lt;/form&gt;
  &lt;?php   if( isset($_POST['next']) ) : $num = $_POST['num']; ?&gt;
          Entered number: &lt;input type="text" name="entered" id="entered" value=" &lt;?=$num ?&gt; "/&gt;
  &lt;?php   endif; ?&gt;
  
  &lt;form action="" method="post"&gt;
      Enter rate: &lt;input type="number" name="rate" id="rate"/&gt;
      &lt;input type="submit" name="calculate" value="Calculate"/&gt;
  &lt;/form&gt;
  &lt;?php   if( isset($_POST['calculate']) ) : $rate = $_POST['rate'];
              if( $rate &gt;=1 &amp;&amp; $rate &lt;=10 ) : echo pow($num, $rate); endif;
          endif;
  ?&gt;
  &lt;/body
  </code></pre>
  
  <p>When the code is executed it shows me:</p>
  
  <pre><code>Notice: Undefined variable: num in ... on line ...
  0
  </code></pre>
  
  <p>What I need to add in the code to recognize the <code>$num</code> variable and execute right the <code>pow()</code>?</p>
  
  <blockquote>
    <p><strong>NB: Don't pay attention to the 'entered' input - it's just for a test.</strong></p>
  </blockquote>