how do i check if a texfield is really empty

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pedrotuga
Forum Contributor
Posts: 249
Joined: Tue Dec 13, 2005 11:08 pm

how do i check if a texfield is really empty

Post by pedrotuga »

Ok...

i am using $_GET ( yes, in this case i really have to use get, i know post is more secure and stuff ) and i want to use something like

Code: Select all

if (isset($_GET["variable_from_text_field"])){
...
}
the problem is: the form allways sends that field variable even if its empty... how can i check if its empty? btw, only spaces shouldnt pass the if test either.
User avatar
aerodromoi
Forum Contributor
Posts: 230
Joined: Sun May 07, 2006 5:21 am

Re: how do i check if a texfield is really empty

Post by aerodromoi »

pedrotuga wrote:Ok...

i am using $_GET ( yes, in this case i really have to use get, i know post is more secure and stuff ) and i want to use something like

Code: Select all

if (isset($_GET["variable_from_text_field"])){
...
}
the problem is: the form allways sends that field variable even if its empty... how can i check if its empty? btw, only spaces shouldnt pass the if test either.
Try using empty();

aerodromoi
User avatar
pedrotuga
Forum Contributor
Posts: 249
Joined: Tue Dec 13, 2005 11:08 pm

Post by pedrotuga »

working

thanks
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

also combine trim() with empty
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply