473,372 Members | 1,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

Saving HTML in a database.

Hi group.
I need to save HTML to a database, but I have to be sure that these text is
well saved, I mean, imagine that you've got a <TEXTAREA> and want to save
the text inside. If the user type an ENTER in the middle of that text then
we need to save this in the database in a format that could be later well
translated.
Does anyone know what function shoul I use or what method should I use?
I've read a few months ago about a function that do this but I don't
remember now.

I hope someone can help me, thanks in advance.

Nuno Paquete.
Jul 23 '05 #1
3 6028

"Nuno Paquete" <nm*@ispgaya.pt> wrote in message
news:40**********************@news.telepac.pt...
Hi group.
I need to save HTML to a database, but I have to be sure that these text is well saved, I mean, imagine that you've got a <TEXTAREA> and want to save
the text inside. If the user type an ENTER in the middle of that text then
we need to save this in the database in a format that could be later well
translated.
Databases have no trouble saving linebreaks.

If you want to turn the linebreak into say a <br>, then you probably would
do that server side a regular expression (or something similar).

Is there a javascript question here?

Jeff
Does anyone know what function shoul I use or what method should I use?
I've read a few months ago about a function that do this but I don't
remember now.

I hope someone can help me, thanks in advance.

Nuno Paquete.

Jul 23 '05 #2
Hi
Is there a javascript question here?

Yes.
Like i said I've read in a book a function that do just that, but I don't
remember the name of the function, and that function is Javascript, I
suppose.

Any more ideas?

Nuno Paquete.
Jul 23 '05 #3
Nuno Paquete wrote:
Hi
> Is there a javascript question here?

Yes.
Like i said I've read in a book a function that do just that, but I don't
remember the name of the function, and that function is Javascript, I
suppose.

Any more ideas?

Nuno Paquete.


"and that function is Javascript" is only true if you are using server-side
Javascript to serve up the content from the database. The mechanism
(function) to change new line characters stored in a database into a <br> for
output as HTML depends entirely on the server-side technology being used.
Note we keep saying "server-side". If you are reading data from a database on
the server, and outputting that to the client as HTML, then you have some
sort of server-side technology available (Perl, PHP, JSP, ASP, ColdFusion,
etc).

The place to change a new line character stored in the database into a <br>
for display as HTML is on the server.

As an example only, if you were using server-side JScript (ASP), you might do
something like:

function newlineToBr(s) {
return s.replace(/\n/g, '<br>');
}

Then you'd use it in your code as:

<td><%= newlineToBr(fieldFromDatabase) %></td>

Other server-side technologies would involve slightly different syntax, but
the concept is the same.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: William Morris | last post by:
We have a number of clients using a web application. Each client sees a slightly different version of, say, a contact input page. As a simple example, Client #1 sees demographics, plus religious...
1
by: John | last post by:
(access 2002) Anyone have any suggestions as to what may be causing access to not save form changes after I "tell" it to, exit database, then re-open later to discover the changes had not been...
6
by: Robm | last post by:
Since googling this issue only brings up the April fool's problem, which was solved years ago, I hope that somebody can help me with this. I have a large vc++/mfc application which needs to know...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
6
by: csgraham74 | last post by:
Hi Guys, I was wondering if someone could help me with a problem that im having. Basically i have a html editor control and im using this to allow my colleague to create html documents. I...
2
by: jessDMiller | last post by:
I have no clue why the data from the form isn't saving into the database. What am I doing wrong? addAnnounce.php: <td align=top> <form action="index2.php" method="post">Heading:<br...
7
by: Bam | last post by:
Hey gang. Is there a way, to automatically save a page that is db driven, as a page that contains html? i would like a page like http://tournamentsbyeck.com/past_standings3.asp to be...
3
by: pozze | last post by:
Hi, I've just made the change from ASP to .net. I have a file (code below) that saves a user submitted file to a MS SQL 2005 database. It collects the file name, file size, file type, and lastly...
10
by: Nathan Sokalski | last post by:
I am using ASP.NET 2.0, and need to know how to save and use an image that is stored in an SQL Server image datatype. How can I do this using ASP.NET? Thanks.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.