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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:33:49+00:00 2026-06-17T04:33:49+00:00

On each example of form processing I found this scenario: if(!empty($_POST)) {… … and

  • 0

On each example of form processing I found this scenario:

if(!empty($_POST)) {... 

… and than – so many lines (sometimes about 250) which belongs to the above if.
Very unsuitable to track.

Is there a way like this:
if(empty($_POST)) {show show some message or echo… anything}, and then – stop the code
So all next lines will be outside of very long if and they’ll still execute only if that if is satisfied.

I tried something, but the members of $_POST (username, pass…) in this case are not available.

  • 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-17T04:33:51+00:00Added an answer on June 17, 2026 at 4:33 am

    Define a function that will execute the code necessary and pass the $_POST variable as an argument. In that way the required variables (e.g. username, password) are now available in the function

    function executePost($post) {
       // execute code here with $post variables
       $username = $post['username'];
       $password = $post['password'];
    }
    

    You call the function after you checked the post

    if(!empty($_POST)) {
        executePost($_POST);
    } else {
       echo 'Post was empty';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(Citing source at: http://jqueryui.com/demos/dialog/#modal-form ) As an example, this works great but each time
For example: > function foo() { > jQuery(whatever).each( function() { return; // this just
I have seen this example on the web: $('#questionTextArea').each( function() { var $this =
I have text in the form of separate lines, where each line has CSV-like
I have a page with more than one form. One form (see below example)
I'm using this example project's XNA 4.0 form control in an application I'm writing:
I know this seems like I should have immediately found the one example out
All the form examples in the docs for jQuery mobile show each form element
I just started using Qt and noticed that in each example code folder there
I need a regex that will give me the following results from each example

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.