PHP if isset OR if isset

Posted on 2014-08-12
Last Modified: 2014-08-12
Is there any way to use 2 If statements together?  Like if one of two different forms have been submitted?

	if(isset($_POST['get_quote'])) || if(isset($_POST['get_empty_quote'] )) { // Handle the form.)

Open in new window

Question by:rgranlund
    LVL 34

    Expert Comment

    Sure. Just think of this:

    if ( boolean || boolean || boolean .... )
        ...then do something...

    Now just replace boolean with your isset() statements. Spacing added for effect:

    if(   isset($_POST['get_quote'])  ||  isset($_POST['get_empty_quote'])     ) { // Handle the form.)

    Open in new window

    LVL 82

    Accepted Solution

    Yes, just leave out the second 'if' and use the parenthesis like this:
    if( (isset($_POST['get_quote'])) || (isset($_POST['get_empty_quote'] )) ) { // Handle the form.)

    Open in new window

    LVL 7

    Author Closing Comment

    Thanks Dave
    LVL 34

    Expert Comment

    Umm... how is my answer not the correct one?
    LVL 82

    Expert Comment

    by:Dave Baldwin
    You might want to re-open this question.  I thought @gr8gonzo's answer would probably work too.  Did you try both of them?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now