Jump to content

Displaying data formatted


graham23s

Recommended Posts

Hi Guys,

 

When i upload a new product i have the data displayed underneath so you can delete it, if you want! but the data displays like:

 

Lanacane Anti-Chafing Gel, relieves and prevents soreness from rubbing skin and skin on clothing.<br />\r\nUnique barrier against friction.<br />\r\nSilky finish - dries on contact.<br />\r\nNon-greasy, non-staining and fragrance free.<br />\r\nLanacane Anti-chafing Gel forms a breathable barrier on your skin, to prevent and aid healing of chafing caused by repeated rubbing of skin on skin or clothing. <br />\r\n<br />\r\nUnique anti-friction formula dries on contact, clear, non-greasy, providing your skin with long lasting relief. <br />\r\n<br />\r\nGentle enough to use anywhere, everyday. <br />\r\n<br />\r\nDirections: A small amount of Lanacane Anti-Chafing Gel goes a long way.<br />\r\nSmooth a small dab on irritated area.<br />\r\nRe-apply if needed.<br />\r\nTo avoid future chafing, apply prior to activity.<br />\r\nIf pain from soreness and rubbing extends 7 days, consult doctor. For external use only. <br />\r\n<br />\r\nIngredients: <br />\r\nCyclopentasiloxane • Dimethicone Crosspolymer • Vinyl Dimethicone Crosspolymer • Zea Mays (Corn starch).

 

instead of niceley formatted i did:

 

<?php
    print("<table width='95%' border='0' cellpadding='5' cellspacing='1' class='tbl_login'>");
    print("<tr>\n");
    print("<td colspan='2' align='left' class='c3'><b>Review Product Details</b></td>\n");
    print("</tr>\n"); 
    print("<tr class=\"c5\">\n");
    print("<td align=\"left\"><img src=\"images/pixel.gif\" width=\"1\" height=\"1\"></td><td align=\"left\"><img src=\"images/pixel.gif\" width=\"1\" height=\"1\"></td>\n");
    print("</tr>\n");
    print("<tr class=\"c1\">\n");
    print("<td width='15%' align='left' class=\"font_for_forms\">Product name:</td><td align='center'><b>$product_name</b></td>\n");
    print("</tr>\n");
    print("<tr>");
    print("<td align='left' class=\"font_for_forms\" valign='top'>Product thumbnail:</td><td align='center' class=\"font_for_forms\"><img src='products/thumbnails/$thumbnail'></td>\n");
    print("</tr>\n");
    print("<tr class=\"c1\">\n");
    print("<td align='left' class=\"font_for_forms\" valign='top'>Product fullsize:</td><td align='center' class=\"font_for_forms\"><img src='products/fullsize/$new_image_name'></td>\n");
    print("</tr>\n");
    print("<tr>\n"); 
    print("<td width='15%' class=\"font_for_forms\" align='left' valign='top'>Product description:</td><td align='left'class=\"font_for_forms\" ><b>" . htmlspecialchars($product_desc) ."</b></td>\n");
    print("</tr>\n");
    print("<tr class=\"c1\">\n");
    print("<td class=\"font_for_forms\" colspan='2' align='right'><input type='submit' name='submit' value='Delete'></td>");
    print("</tr>\n"); 
    print("</table>\n");
?>

 

but that does work! is there another function i should use round the description variable?

 

thanks guys

 

Graham

Link to comment
https://forums.phpfreaks.com/topic/121434-displaying-data-formatted/
Share on other sites

 
<?php 

$text = "Lanacane Anti-Chafing Gel, relieves and prevents soreness from rubbing skin and skin on clothing.<br />\r\nUnique barrier against friction.<br />\r\nSilky finish - dries on contact.<br />\r\nNon-greasy, non-staining and fragrance free.<br />\r\nLanacane Anti-chafing Gel forms a breathable barrier on your skin, to prevent and aid healing of chafing caused by repeated rubbing of skin on skin or clothing. <br />\r\n<br />\r\nUnique anti-friction formula dries on contact, clear, non-greasy, providing your skin with long lasting relief. <br />\r\n<br />\r\nGentle enough to use anywhere, everyday. <br />\r\n<br />\r\nDirections: A small amount of Lanacane Anti-Chafing Gel goes a long way.<br />\r\nSmooth a small dab on irritated area.<br />\r\nRe-apply if needed.<br />\r\nTo avoid future chafing, apply prior to activity.<br />\r\nIf pain from soreness and rubbing extends 7 days, consult doctor. For external use only. <br />\r\n<br />\r\nIngredients: <br />\r\nCyclopentasiloxane • Dimethicone Crosspolymer • Vinyl Dimethicone Crosspolymer • Zea Mays (Corn starch).";

echo $text ;     seems to work. is there any other code used in the output routine?

echo "<br><br>" ;

echo nl2br($text) ; // provides extra space
?>

 

 

myouput for the above is respectively:

 

 

Lanacane Anti-Chafing Gel, relieves and prevents soreness from rubbing skin and skin on clothing.

Unique barrier against friction.

Silky finish - dries on contact.

Non-greasy, non-staining and fragrance free.

Lanacane Anti-chafing Gel forms a breathable barrier on your skin, to prevent and aid healing of chafing caused by repeated rubbing of skin on skin or clothing.

 

Unique anti-friction formula dries on contact, clear, non-greasy, providing your skin with long lasting relief.

 

Gentle enough to use anywhere, everyday.

 

Directions: A small amount of Lanacane Anti-Chafing Gel goes a long way.

Smooth a small dab on irritated area.

Re-apply if needed.

To avoid future chafing, apply prior to activity.

If pain from soreness and rubbing extends 7 days, consult doctor. For external use only.

 

Ingredients:

Cyclopentasiloxane • Dimethicone Crosspolymer • Vinyl Dimethicone Crosspolymer • Zea Mays (Corn starch).

 

 

 

--------> with nl2br

 

Lanacane Anti-Chafing Gel, relieves and prevents soreness from rubbing skin and skin on clothing.

 

Unique barrier against friction.

 

Silky finish - dries on contact.

 

Non-greasy, non-staining and fragrance free.

 

Lanacane Anti-chafing Gel forms a breathable barrier on your skin, to prevent and aid healing of chafing caused by repeated rubbing of skin on skin or clothing.

 

 

 

Unique anti-friction formula dries on contact, clear, non-greasy, providing your skin with long lasting relief.

 

 

 

Gentle enough to use anywhere, everyday.

 

 

 

Directions: A small amount of Lanacane Anti-Chafing Gel goes a long way.

 

Smooth a small dab on irritated area.

 

Re-apply if needed.

 

To avoid future chafing, apply prior to activity.

 

If pain from soreness and rubbing extends 7 days, consult doctor. For external use only.

 

 

 

Ingredients:

 

Cyclopentasiloxane • Dimethicone Crosspolymer • Vinyl Dimethicone Crosspolymer • Zea Mays (Corn starch).

 

 

 

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.