I would do this:
if (!$AgeChild) $AgeChild = 'NA';
More compact, easier to read (to me, anyway). This presumes that a
value of '' (empty string, interpreted by PHP as false) is NOT a
valid value here.
As far as your sniplet goes, it is possible that there may be some
PHP type-casting issues here, depending on: whether $AgeChild is
numeric or string; the fact that the STRING "false" isn't equivalent
to the CONSTANT false, the use of == vs. ===.
Time to check out the docs - specifically the types and variables
sections (also the functions->variables section)...
- steve
At 5:07 PM -0600 2/22/01, Jacky@lilst wrote:
>People
>I tried to check if teh field has set a vaule in it before submit
>using isset with the sniplet below
>
>if ((isset($AgeChild))=="false") {
>$AgeChild = "NA";
>}
>
>The resule is that it always displays NA whether or not it has vaule
>in the field, what is the correct way of using isset for this
>purpose? Or should I use empty() ?
>Jack
>[EMAIL PROTECTED]
>"There is nothing more rewarding than reaching the goal you set for yourself"
--
+--- "They've got a cherry pie there, that'll kill ya" ------------------+
| Steve Edberg University of California, Davis |
| [EMAIL PROTECTED] Computer Consultant |
| http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ |
+-------------------------------------- FBI Special Agent Dale Cooper ---+
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]