RE: [PHP] check null value

From: Date: Tue, 23 Jan 2001 12:43:25 +0000
Subject: RE: [PHP] check null value
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-36176@lists.php.net to get a copy of this message
I would try: if (isset($fieldname) && empty($fieldname)){ // do something here with the variable } else { $fieldname="na"; } // if (isset($fieldname) && empty($fieldname)) Cal http://www.calevans.com -----Original Message----- From: Jacky@lilst [mailto:jacky@activelifestyle.com] Sent: Tuesday, January 23, 2001 3:18 PM To: php-general@lists.php.net Subject: [PHP] check null value If I have one input text box that when it is submitted to next page, I want to check first if it is nothing, then write "na" on next page, else just echo whatever it is, is it correct to do this? if ($fieldname == ""){ $fieldname ="na"; } ... (then come to the html bit below) <td><?php echo $fieldname ?></td> I wonder specificly about the check if it is null part if it is corerct. Any thoughts? Jack jacky@activelifestyle.com "There is nothing more rewarding than reaching the goal you set for yourself"

« previous php.general (#36176) next »