Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8695083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:56:39+00:00 2026-06-13T00:56:39+00:00

I am using a simple form to set the name of a hashtag into

  • 0

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

    <form id"search" method="post" action="twitter.php">
    <input type="text" name="hash" id="hash"/>
    <input type="submit" name="submit" value="submit"/>
    </form>   

My php displays the results of a hash tag search

    <?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).'&';
    $url .= 'page='.$page;    
    $ch = curl_init($url);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $json = curl_exec ($ch);
    curl_close ($ch);
    echo "<pre>";    
    $json_decode = json_decode($json);
    print_r($json_decode->results);

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

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:56:42+00:00Added an answer on June 13, 2026 at 12:56 am

    Post it to the same page, you define an action in your form “twitter.php” this means the form will go to the page twitter.php with the post information.

    If you post it to the same page, catch the post request there and display whatever was requested there either below or above the form both elements are shown on the page.

    Small example:

    <?php
    if ($_SERVER['REQUEST_METHOD'] == "POST" && !empty($_POST['hashtag'])) {
        echo "You searched for: " . $_POST['hashtag'] . "!";
    }
    ?>
    <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
        Hashtag: <input type="text" name="hashtag" /> <br />
        <input type="submit" value="Submit hashtag!" />
    </form>
    

    this will display a form with an input field for the hashtag. the script is posted to the same page, the PHP catches the POST request and displays whatever is searched. Instead you could use this value to retrieve the search action from twitter itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a simple web form and some PHP script to send the completed
Here is a simple form I am using to send XML data in admin_xml.php
I'm using the jQuery validation plugin for a simple form (name, email, and phone
I am using simple form gem and I am wondering how do you do
I have started using Simple-form and Bootstrap and I have tried to follow this
Im using the Simple form gem to setup a form on my rails app.
I have installed VS2010 and MVC2 and testing a simple form using tinyMCE. When
Im using regular asp.net c# (webforms) i need to build a simple form that
I am trying to set up validation on a simple contact form that is
I've created a simple contact form using the modelformset_factory to build the form in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.