Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 12th, 2006, 6:36 PM   #1
ktsirig
Programmer
 
Join Date: Oct 2005
Posts: 54
Rep Power: 4 ktsirig is on a distinguished road
store whitespace but not interpret it in <br>

Hello all,

my problem is the following: I have a page where the user enters some data, let's say :

string1 = 'AGREHREHRHREHRE';
string2 = 'WEFEWGEWGEGEWGEGEGWG';

These data I use in another page, so I use the "<pre>" tag to display what the user has entered. The problem arrives when the user writes something like EWGEGEW EFGEGEW EGRGREGRE RGVFVDSVDS

This string, when I pass it into a variable, it is stored with newlines. I don't want to make any substitution of the newlines, as I want to preserve the spaces in the next page, and display the user's sequence as entered and not with 3 <br>'s, because there were 3 spaces in the original string...
any ideas?
ktsirig is offline   Reply With Quote
Old Apr 12th, 2006, 6:44 PM   #2
mongeau
Newbie
 
mongeau's Avatar
 
Join Date: Apr 2006
Location: Fargo, ND
Posts: 29
Rep Power: 0 mongeau is on a distinguished road
Send a message via MSN to mongeau
Not really...

Can you show us a working example of this? I could better understand what you want from that. If you want to preserve what the user entered without substituting \n characters with <br /> tags, then I suggest you print the variable in a <textarea> (it will interpret the \n character appropriately).
__________________
I wish I was you, so I could be friends with me.
mongeau is offline   Reply With Quote
Old Apr 12th, 2006, 6:59 PM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Do you have some preconceived notion that spaces and newlines are equivalent or that one is presented as the other, aside from during the rendering of the page?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:07 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC