djfox Posted December 29, 2007 Share Posted December 29, 2007 I have the following sting: <br>Msn: <b><? echo $user[8]; ?></b> If $user[8] is empty, I want that entire string to just not show up. But if $user[8] does have something, I want that string to be visible. How do I make that happen? Link to comment https://forums.phpfreaks.com/topic/83615-solved-make-string-not-appear-if-field-is-empty/ Share on other sites More sharing options...
revraz Posted December 29, 2007 Share Posted December 29, 2007 <?php if ($user[8]) { echo "<br>Msn: <b>$user[8]</b>"; } ?> Link to comment https://forums.phpfreaks.com/topic/83615-solved-make-string-not-appear-if-field-is-empty/#findComment-425382 Share on other sites More sharing options...
djfox Posted December 29, 2007 Author Share Posted December 29, 2007 Thanks very much! Link to comment https://forums.phpfreaks.com/topic/83615-solved-make-string-not-appear-if-field-is-empty/#findComment-425384 Share on other sites More sharing options...
redarrow Posted December 29, 2007 Share Posted December 29, 2007 playing with ur code lol.......... <?php $user[8]="redarrow"; if ($user[8]) { $x=$user[8]; $x="User $x there!"; }else{ $x="user not there"; } echo "<br>Msn: <b>$x</b>"; ?> Link to comment https://forums.phpfreaks.com/topic/83615-solved-make-string-not-appear-if-field-is-empty/#findComment-425388 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.