have a look at get_html_translation_table() in the php manual.

there is an example of conversion of all special chars so they can be
inserted into the database as text (i.e. £>&pound) and a cool way of
'decoding' them if you need to write them to a file. A Browser wil interpret
them correctly when they are displayed.

This must be the question of the day as i have posted this answer three
times today :-)

Let me know if you need any more help


get_html_translation_table manual page is below:

      PHP Manual
      Prev  Next


(PHP 4 >= 4.0b4)

get_html_translation_table --  Returns the translation table used by
htmlspecialchars() and htmlentities()

string get_html_translation_table (int table [, int quote_style])

get_html_translation_table() will return the translation table that is used
internally for htmlspecialchars() and htmlentities(). There are two new
defines (HTML_ENTITIES, HTML_SPECIALCHARS) that allow you to specify the
table you want. And as in the htmlspecialchars() and htmlentities()
functions you can optionally specify the quote_style you are working with.
The default is ENT_COMPAT mode. See the description of these modes in
htmlspecialchars(). Example 1. Translation Table Example

$trans = get_html_translation_table (HTML_ENTITIES);
$str = "Hallo & <Frau> & Krämer";
$encoded = strtr ($str, $trans);

The $encoded variable will now contain: "Hallo &amp; &lt;Frau&gt; &amp;

The cool thing is using array_flip() to change the direction of the

$trans = array_flip ($trans);
$original = strtr ($str, $trans);

The content of $original would be: "Hallo & <Frau> & Krämer".
  Note: This function was added in PHP 4.0.

See also: htmlspecialchars(), htmlentities(), strtr(), and array_flip().

      Prev Home Next
      explode Up get_meta_tags

"Jay Fitzgerald" <[EMAIL PROTECTED]> wrote in message
> Ok, I am still fairly new at PHP and MySQL also, so please bear with me.
> TASK: I have a client that wants to have job openings listed on their site
> and they want to be able to add, edit and delete the postings themselves.
> would do this in flat-file format but there is the risk of that file size
> getting too large and slowing down the server.
> SOLUTION: I have created a MySQL database that will hold all the postings
> in a table called 'jobs' and have created a PHP form that will post this
> jobs into the db.
> PROBLEM: When I go to the PHP form and enter all of the pertinent job
> information, there is one specific field that will have to have carriage
> returns/line breaks in it between paragraphs. Everything is working except
> for this. Is there a way whenever the user presses <ENTER>, that either
> PHP/MySQL will convert this into a <BR> tag only when being displayed in a
> browser and not in the db??
> Can anyone out there please help me with this? I am available off-list as
> well if it will be easier to pass code back and forth. Any assistance is
> greatly appreciated!
> Should you have any questions, comments or concerns, feel free to call me
> at 318-338-2034.
> Thank you for your time,
> Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A
> ==========================================================
> Bayou Internet..............(888)
> 30-BAYOU........................http://www.bayou.com
> Mississippi Internet.......(800)
> MISSISSIPPI...............http://www.mississippi.net
> Vicksburg Online..........(800)
> MISSISSIPPI................http://www.vicksburg.com
> ==========================================================
> Tel: (318) 338-2034                ICQ: 38823829                     Fax:
> (318) 323-5053

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