Jump to content

syntax error maybe?


Weiss

Recommended Posts

Hi. ok ive been working for about 2 hours on 2 lines that for some reason doesnt work. 

i have a form with 2 inputs: order# and phone#. 

when user press submit i want it to search the DB. if he entered both phone# and order# the query will be other than if he entered only one of them. 

so actually  i have 4 cases. 1: user submitted without phone# and without order#

2: user submitted with phone# but without order#

3: user submitted without phone# but with order#

4: user submitted with both.

can someone help me with the syntax? ive been working on it for freaking hours and it doesnt seem to work. 

Edited by Weiss
Link to comment
Share on other sites

if (isset($_GET['submit'])){
$flag =1;//1 means both phone# and order# are entered

    if (!isset($_GET['order_num'])) 
	    { if (!isset($_GET['phonesrch'])) 
		             {$flag=2;} //means order# isnt set and phonesrch isnt set
				else{ $flag=3; }//means order# isnt set but phone# is set
        }
		else {if (!isset($_GET['phonesrch'])) {flag=4;} //means order# is set, phone# isnt
		     }

this is my code but somewhere i guess theres a syntax error

Link to comment
Share on other sites

Yes thank you, realised that just now. do you think there's a better way to attack this other than all this nested if's ?

 

btw, if isset returns true all the time do i still need it? or can i just use the !empty?

Edited by Weiss
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...