Web Hosting Talk







View Full Version : Print new line in textarea problem !!


Badie
10-02-2007, 03:57 PM
Hi,

I have 2 pages , one contain contact form and the other is to make validation, user Must enter his email, name & message.

When someone fill the message (textarea) and forget to put the other information and click send , the data will be posted in the 2ed page, its check the fields so, if something messing the 2ed page takes him back to the contact form page and shows a error message.

in order to make the customer add the missing information without rewrite the message that he is already sent, i send back the message information by session and its display back in the textarea.

The Problem:

if the write his message with break using ENTER, and he send the data , when its return its will show up with \n ..

for example if he write in the text area

Hi
i want some help

then he click send , when he back to the page , the data in the text area will be :
hi\n\iwantsomehelp

i try many times with nl2br and replace functions but nothing work !!

any idea ?
Thanks

isurus
10-02-2007, 06:04 PM
Have you looked at stripcslashes() ?

Badie
10-03-2007, 04:22 AM
man thanks , you know i spend much time look in this problem and met a lot of function , looks this stripcslashes the only one i did not notice that one

its work thanks alot

Badie
10-03-2007, 04:24 AM
thanks man ,

ubersmith_boo
10-04-2007, 11:03 AM
If you're just checking that they entered a value in the forms on the first page, it might be cleaner to just add some javascript to check the form before it is submitted and throw an alert() if it's not satisfactory.