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

  • Home
  • SEARCH
  • 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 8171379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:26:35+00:00 2026-06-06T21:26:35+00:00

I am new to php and need to understand how post get method could

  • 0

I am new to php and need to understand how post get method could be useful for my code. My scenario is, I have 3 webpages, 1st webpage is an html form , I am using post method here then I take firstname and last name from form and enter in a sql query(for e.g. $_POST[firstname]) on 2nd webpage which generates some data for me and I am printing that data.

Now I need to pass same parameters to 3rd page which generates some graph based on firstname and lastname entered in 1st HTML form?

How can I persist these values on 3rd php page? I am referencing url for page 3 on page and I believe that is not sufficient, I tried Google search and found out post get could be useful however need some expert advice.

Thanks

  • 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-06T21:26:38+00:00Added an answer on June 6, 2026 at 9:26 pm

    You can use something like this:

    1st page (page1.php)

    <form action="page2.php" method="post">
        <input type="text" name="firstname" value="" />
        <input type="text" name="lastname" value="" />
        <input type="submit" value="Submit" />
    </form>
    

    2nd (page2.php)

    Retrieve and validate $_POST['firstname'] and $_POST['lastname'], then create an output with your required data, you can use hidden fields or create links, according your needs. For instance:

    $firstname = $_POST['firstname'];
    $lastname  = $_POST['lastname'];
    
    // Output with links can pass data by GET method
    echo '<a href="page3.php?firstname='.$firstname.'&lastname='.$lastname.'"></a>';
    
    // Output with hidden fields, you can use POST or GET method or even Javascript/Ajax
    echo '
    <form action="page3.php" method="get">
        <input type="hidden" name="firstname" value="'.$firstname.'" />
        <input type="hidden" name="lastname" value="'.$lastname.'" />
        <input type="submit" value="Submit" />
    </form>';
    

    3rd page (page3.php)

    If you use the solution with a link or with a form with GET method, you can retrieve the data in page3.php just doing the following:

    $firstname = $_GET['firstname'];
    $lastname  = $_GET['lastname'];
    

    Hope it can help you!

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

Sidebar

Related Questions

I'm new to php and I need a hand. I have width by height
I am new to PHP. I need to GET a xml stored locally using
I'm fairly new to python. I have an error that I need to understand.
I'm new to PHP so I don't know whether this is possible. I need
I need to use mod_rewrite to redirect http://www.site.com/new_cars/cars.php?make=brandname to have a friendlier url of
Im new to JSON and php. I need to grab the lat and lng
New to PHP and MySQL, have heard amazing things about this website from Leo
EDIT: Yields that there is already new PHP framework written as extension. http://code.google.com/p/yafphp ,
I could really do with some advice here. I'm new to Django, but understand
I am a bit new to PHP OOP so I need you guys help

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.