display processed form php results in original page where form was executed
<p>I am using a simple form to set the name of a hashtag into a php file but I want the results to be displayed on the same page as the form.
My form and php is as follows</p>

<pre><code>    &lt;form id"search" method="post" action="twitter.php"&gt;
    &lt;input type="text" name="hash" id="hash"/&gt;
    &lt;input type="submit" name="submit" value="submit"/&gt;
    &lt;/form&gt;   
</code></pre>

<p>My php displays the results of a hash tag search</p>

<pre><code>    &lt;?php
    global $total, $hashtag;
    $hashtag = $_POST["hash"];
    $total = 0;
    function getTweets($hash_tag, $page) {
    global $total, $hashtag;
    $url = 'http://search.twitter.com/search.json?q='.urlencode($hash_tag).'&amp;';
    $url .= 'page='.$page;    
    $ch = curl_init($url);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $json = curl_exec ($ch);
    curl_close ($ch);
    echo "&lt;pre&gt;";    
    $json_decode = json_decode($json);
    print_r($json_decode-&gt;results);

    $json_decode = json_decode($json);        
    $total += count($json_decode-&gt;results);    
    if($json_decode-&gt;next_page){
     $temp = explode("&amp;",$json_decode-&gt;next_page);        
     $p = explode("=",$temp[0]);                
     getTweets($hashtag,$p[1]);
      }        
    }
  echo $total;
  getTweets($hashtag,1);
    ?&gt;
</code></pre>

<p>What should I do to get the results of the php to display on the same page as below the form
Thanks in advance</p>
