?
Solved

PHP if isset OR if isset

Posted on 2014-08-12
5
Medium Priority
?
232 Views
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

0
Comment
Question by:rgranlund
  • 2
  • 2
5 Comments
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 40256717
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

0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 40256718
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

0
 
LVL 7

Author Closing Comment

by:rgranlund
ID: 40256808
Thanks Dave
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 40256877
Umm... how is my answer not the correct one?
0
 
LVL 84

Expert Comment

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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month16 days, 6 hours left to enroll

850 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