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 9203321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:26:51+00:00 2026-06-17T23:26:51+00:00

Sorry if this is a rather basic question. I have a page with an

  • 0

Sorry if this is a rather basic question.

I have a page with an HTML form. The code looks like this:

<form action="submit.php" method="post">
  Example value: <input name="example" type="text" />
  Example value 2: <input name="example2" type="text" />
  <input type="submit" />
</form>

Then in my file submit.php, I have the following:

<?php
  $example = $_POST['example'];
  $example2 = $_POST['example2'];
  echo $example . " " . $example2;
?>

However, I want to eliminate the use of the external file. I want the $_POST variables on the same page. How would I do this?

  • 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-17T23:26:53+00:00Added an answer on June 17, 2026 at 11:26 pm

    Put this on a php file:

    <?php
      if (isset($_POST['submit'])) {
        $example = $_POST['example'];
        $example2 = $_POST['example2'];
        echo $example . " " . $example2;
      }
    ?>
    <form action="" method="post">
      Example value: <input name="example" type="text" />
      Example value 2: <input name="example2" type="text" />
      <input name="submit" type="submit" />
    </form>
    

    It will execute the whole file as PHP. The first time you open it, $_POST['submit'] won’t be set because the form has not been sent.
    Once you click on the submit button, it will print the information.

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

Sidebar

Related Questions

Sorry for this rather basic question, but I have to get some sort of
Sorry in advance if this is a really basic Matrix/OpenGl question. I have a
sorry if this is a basic question! up till now i have been creating
Sorry if this question is too vague, but I'd rather not muddy it's point
Rather new to php, so sorry if this seems stupid. I'm really copying a
Sorry this is a basic question, but all my research just barely missed answering
(Sorry this is rather a vague question. My attempts to be clearer [and indeed
Sorry if this is too basic. I have a csv file where the columns
Sorry that this is a rather large question. I cannot get the following C++
Sorry this is not a very well defined question, I am thinking about an

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.