Tarik, > - what is the stored character code of the enter key in the text field, i am > figuring out to find that character and replace it with the <br> element, > for the exact display,
The character is "\n" (the new line character). If you use PHP and have magic_quotes=on in your php.ini, PHP will automatically escape certain characters like \n. If magic_quotes=off, you can use the addslashes() function to accomplish this. When retrieving the data out of MySQL to display them in a textarea field once again, you have to do nothing. The web browser will take care of converting \n into something the operating thinks is a new line (Unix: \n, Windows: \r\n, MacOS: \r). If you want to display the data outside of form fields, you will have to convert \n into something HTML knows is a new line. HTML uses for example <br> or <p> for this. In PHP, you can use the nl2br() function that will convert \n into <br>. If you don't use PHP, things might be a bit more complicated. Regards, -- Stefan Hinz <[EMAIL PROTECTED]> Geschäftsführer / CEO iConnect GmbH <http://iConnect.de> Heesestr. 6, 12169 Berlin (Germany) Tel: +49 30 7970948-0 Fax: +49 30 7970948-3 ----- Original Message ----- From: "Tarik Kutluca" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 31, 2003 5:22 PM Subject: line breaks > Hi, > > From a web form I am collecting information to a table. On the form there is > a textarea element storing to a text field on the mysql table. Since the > textarea can hold the enter key, it's stored in to the field also, but when > i try to call that cell and display it on the web page, i see that line > breaks are ignored. But the sentences must be displayed as they are entered. > > - what is the stored character code of the enter key in the text field, i am > figuring out to find that character and replace it with the <br> element, > for the exact display, > > - do you have a shorter way to do this? > > thank you > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php