This is a discussion on "PHP and textareas" within the PHP Forum section. This forum, and the thread "PHP and textareas are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
PHP and textareas
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
PHP and textareas
Hi all,
I have a page which includes a textarea fro the user to submit data in order to be retrieved from Mysql tables Question: I am confused about the 'wrapping' thing of textareas. I have tried 'virtual' and 'physical' and nothing seems to work. What I want to do is when the user supplies ,for example, 4 data separated by <ENTER>, the page break not to dissapear, that is, I want data1 data2 data3 data4 to remain as above and not data1data2data3data4 What am I doing wrong??? |
|
|
|
#2
|
|||
|
|||
|
data1
? |
|
#3
|
|||
|
|||
|
Re: PHP and textareas
Quote:
Echo your ouput using: nl2br(htmlspecialchars(stripslashes($_REQUEST[fred]))) where "fred" is the name of your textarea. This solutions also protects you against users who echo HTML tags within your text area; in detail stripslashes removes any extra \ characters added by PHP htmlspecialchars encodes characters such as < & and " nl2br changes any new line characters into tags |
|
#4
|
|||
|
|||
|
I guess I wasn't very clear in the first place.
Tha data which the user will write in the text area, are not shown to the screen via a PHP script. Instead, they are used as input for another PHP program doing other job. So, my problem is that I need to 'hold' the newline characters that may be inserted by the user when he/she presses the 'ENTER' key. For example, if user writes: My name is Nick the PHP program called through the textarea must treat the above lines as they are and not like My name is Nick That is my problem: What must I do to preserve the newline characters. I think grahame's proposal is what I need. Will try that! Thanx to both of you for your time!! |
![]() |
| Tags |
| php, textareas |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| selections within textareas | benbacardi | JavaScript Forum | 16 | Feb 16th, 2005 13:59 |