Re: ISSET() question
- From: Tony <nospam@xxxxxxxxxxx>
- Date: Thu, 28 Feb 2008 17:23:22 -0800
major wrote:
The following code processes a blank field as though it has some value
and proceeds as though it was set to some value.
Apparently isset() is not working, because it thinks that a blank text
field is set to something.
Yes, if the value of a field is "", then it is still set. You would want to test for both:
if ( isset($_POST['name']) && ($_POST['name'] != "") ) ...
Or, if you want to count " " as blank:
if ( isset($_POST['name']) && (trim($_POST['name']) != "") ) ...
There may be a more efficient way to do this - anyone know of one?
.
- Follow-Ups:
- Re: ISSET() question
- From: Norman Peelman
- Re: ISSET() question
- References:
- ISSET() question
- From: major
- ISSET() question
- Prev by Date: Re: DOCTYPE
- Next by Date: Re: ISSET() question
- Previous by thread: Re: ISSET() question
- Next by thread: Re: ISSET() question
- Index(es):