try using the htmlspecialchars() function instead - works for me :)

// -----Original Message-----
// From: Nally, Tyler G. [mailto:[EMAIL PROTECTED]]
// Sent: Wednesday, 3 October 2001 6:29 AM
// To: '[EMAIL PROTECTED]'
// Subject: [PHP-DB] Storing HTML in database
// 
// 
// Hello,
// 
// I'm trying to store HTML (that is cut-n-paste from source)
// into a textarea field on a web page.  As it's submitted to
// the php page that processes it, the database column that
// it ends up with strips the "<" and ">" out of the html
// so that it doesn't end up in the source.  
// 
// Example.... I can cut-n-paste... the following into a textarea...
// 
// --------------original test html code------------------------
// <i>this is supposed to be in italics</i>
// <b>this is supposed to be bold</b>
// <table>
//  <tr>
//    <td align="left" valign="top">Column 1, Row 1</td>
//    <td align="left" valign="top">Column 2, Row 1</td>
//  </tr>
//  <tr>
//    <td align="left" valign="top">Column 1, Row 2</td>
//    <td align="left" valign="top">Column 2, Row 2</td>
//  </tr>
// </table>
// -------------------------------------------------------------
// 
// ... and process it with htmlentities() by the receiving php page 
// as it will show...
// 
// ----original code as received and displayed in php 
// processing page------
// <i>this is supposed to be in italics</i>
// <b>this is supposed to be bold</b>
// <table>
//  <tr>
//    <td align=\"left\" valign=\"top\">Column 1, Row 1</td>
//    <td align=\"left\" valign=\"top\">Column 2, Row 1</td>
//  </tr>
//  <tr>
//    <td align=\"left\" valign=\"top\">Column 1, Row 2</td>
//    <td align=\"left\" valign=\"top\">Column 2, Row 2</td>
//  </tr>
// </table>
// -------------------------------------------------------------
// ------------
// 
// Which I can deal with easily enough... but when the same 
// is posted, processed (w/ htmlentities), and retrieved from the
// MySQL database, I receive the following ....
// 
// --------------original code as retrieved from 
// database------------------
//  i this is supposed to be in italics /i 
//  b this is supposed to be bold /b
//  table
//  tr
//    td align=\"left\" valign=\"top\" Column 1, Row 1 /td
//    td align=\"left\" valign=\"top\" Column 2, Row 1 /td
//  /tr
//  tr
//    td align=\"left\" valign=\"top\" Column 1, Row 2 /td
//    td align=\"left\" valign=\"top\" Column 2, Row 2 /td
//  /tr
// /table
// -------------------------------------------------------------
// -----------
// 
// What am I doing wrong?  This just can't be rocket science.
// There's probably something essential that I'm missing.
// 
// Thanks much....
// --
//     __           _                                Tyler Nally
//    / /__  ____ _(_)___  ____   ____  _________ _  [EMAIL PROTECTED]
//   / / _ \/ __ `/ / __ \/ __ \ / __ \/ ___/ __ `/  317-860-3009
//  / /  __/ /_/ / / /_/ / / / // /_/ / /  / /_/ /   American 
// Legion Website
// /_/\___/\__, /_/\____/_/ /_(_)____/_/   \__, /    
http://www.legion.org
       /____/                          /____/   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to