Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Using html in an input text field

New Here ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

Hey all,

I need to be able to retain some kind of formatting when placing data in a mysql database.
Currently when the data is pulled back out of the db it is just one loooonnnnnng string. Thats no good. I need at the very least paragraphs formatted.

I am using a standard web form to input text and I am aware that I can use html tags to format text on the way in, however the problem lies with my clients knowing nothing about html, and nor do they want to for that matter.

Is there any way to keep formating when using standard web forms?

Thanks
TOPICS
Server side applications

Views

390
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

I take it your using PHP.

Just the nl2br() command, which converts new line codes to <br> codes, so
that the code is shown as it was entered when shown in a browser.

Gareth
http://www.phploginsuite.co.uk/
PHP Login Suite V2 - 34 Server Behaviors to build a complete Login system.


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

Thanks mate,

You are right - I am using php. That will take care of line breaks.
Now.... what about other formatting? Bold text, italics, color?

Am I asking too much?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

Well you can allow people to enter HTML tags themselves, but make sure you
weed out any <script> tags etc, which allow people to do nasty things, such
as redirect people viewing the page to a different site.

Gareth
http://www.phploginsuite.co.uk/
PHP Login Suite V2 - 34 Server Behaviors to build a complete Login system.


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 15, 2006 Jun 15, 2006

Copy link to clipboard

Copied

LATEST
Ok, but the problem is my clients dont know any html and dont care to learn it either!

What I'm after is something similar to the form I am using to enter this post.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines