Jump to content

add a <br> to string


harkly

Recommended Posts

I am trying to get a <br> to come before

if ($r['othr_pet']) $string .= $r['othr_Pet_txt'];

So that if the string has something in it, it will properly break before as like the Cat & Fish

 

while($r = mysql_fetch_array($sql)) {
   
$string = "";

if ($r['dog']) $string .= "Dog(s) ";
if ($r['cat']) $string .= "<br>Cat(s) ";
if ($r['fish']) $string .= "<br>Fish(s) ";
if ($r['othr_pet']) $string .= $r['othr_Pet_txt'];

echo " $string "; 
} // END While

 

The out come I am looking for is to

Link to comment
https://forums.phpfreaks.com/topic/234162-add-a-to-string/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.