Page 1 of 1

Checking if a variable has been set?

Posted: Sun Jul 08, 2007 11:55 pm
by bos45430
Could anyone tell me how to check if a variable has been assigned a value. I want to make it where my code checks to see if they filled out a text field or not.

THanks for your help

John

Posted: Mon Jul 09, 2007 12:10 am
by Zoxive

Code: Select all

empty();
isset();

Posted: Mon Jul 09, 2007 12:25 am
by bos45430
right on. exactly what i was looking for. THANKS!

Posted: Mon Jul 09, 2007 6:00 am
by designerman
you can also check for if($foo == ""){ // contained nothing } becuase you may set a var in your code before and check for this

You can clear the contents of a var by using the empty function

Posted: Mon Jul 09, 2007 6:19 am
by Gente
designerman wrote:you can also check for if($foo == ""){ // contained nothing } becuase you may set a var in your code before and check for this

You can clear the contents of a var by using the empty function
Please be careful with you posts. Zoxive posted the valid answer. Your proposition isn't really good.