If Else troubles<

admin

Administrator
Staff member
Hello,

I have a page which queries a database for a persons name. The person MAY also have a partner. Basically the output writes a letter and I want it to print an & if there is a second person and nothing after the first persons name if there isn't.

I use code like so:
if (isset($row_rsClient['name2'])){echo " & ";}

However, it seems that if the database has a space in it for the second person I get

Dear Client One &


Is there a way I can do it so as if the second applicant field name is blank OR a space it misses off the &

Please let me know if you need any more info as I am aware that this may read quite vaguely!if (isset(trim($row_rsClient['name2']))){echo " & ";}

or

if (!empty($row_rsClient['name2'])){echo " & ";}

or

if ($row_rsClient['name2'] != ""){echo " & ";}Scoutt,
you are a star.
I thank you.
 
Back
Top