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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:27:44+00:00 2026-06-05T17:27:44+00:00

I have come across scripts that use: isset($_POST[‘submit’]) as well as code that uses:

  • 0

I have come across scripts that use:

isset($_POST['submit'])

as well as code that uses:

$_SERVER['REQUEST_METHOD']=='POST'

I was wondering the difference between these two and which method is best.

  • 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-05T17:27:46+00:00Added an answer on June 5, 2026 at 5:27 pm

    These mean two different things. The first, checks to see if when the form was submitted the parameter submit was passed. Many use this snippet to verify that a form has been sent. This works because the submit button is technically an <input> so it’s value is sent along with any other elements that were part of the form.

    <?php
        if(isset($_POST['submit'])) { // This way form and form logic can be adjacent to each other
            // Logic
        }
    ?>
    <form method='POST' action='<?= $_SERVER['REQUEST_URI'] ?>'>
       <!--- other form stuff -->
       <input type="submit" name="submit" value="Send!" />
    </form>
    

    The second snippet tests if the form was submitted with the POST method. This doesn’t necessarily mean that the form button was pushed. If it wasn’t submitted with POST, then the superglobal $_POST would be empty.

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

Sidebar

Related Questions

I have come across the following jQuery code but could not understand it. What
I have come across a class that has an immutable property: MyObject[] allObjs The
I have come across an annoying problem while writing some PHP4 code. I renamed
We have come across a scenario where we need to track the setting and
I have come across a situation (which I think is weird but is possibly
I have come across a very weird error. I'm on Solaris 10, using Ruby
I have come across some strange behaviour, and I'm assuming a bug in Firefox,
I have come across Evernote's bookmarklet and was wondering how this worked. You can
I have come across this great function/command . Colour to RGB, you can do
I have come across many ad hoc implementations of thread class in C++, but

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.