Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formatting textfield and saving html tags on database..

Status
Not open for further replies.

Keendev

Technical User
Jan 23, 2006
106
PH
Hi,
I have a formatting textfield where they can edit
font etc..

q:
What data type I will use on my datafield to save the html tags and can support big number of characters ?

so I can save all tags.

tnx.
 
<font color='blue'>"?
- yup, but the user will just click and select color etc.

so they dont have to type it in color=blue...

And when they click the form submit button , I need to save it on my database table.

What will be my datafield type for my formatting textarea field?
 
i would use longtext as a datatype. or just store the content in the filesystem.

remember to escape the text before saving it to the database. you might consider mysql_real_escape_string() to do this. note that you need to be connected to the db server and database before using this command. if this is not feasible then use mysql_escape_string() instead.

remember also that if you want to display the output you just echo the content of the field. if you want to give users the chance to edit the output and html you must echo html_entities($string) inside the textarea. bespoke controls (ie wysisig editors) may have their own requirements.
 
Hi,

Have you considered doing this in CSS instead?
Eg. CSS coloring and simply swap the stylesheet, based on user preference

Code:
if (is_file(stylesheet($__usrpref))) {
  genSheet($__usrpref);
  }

However, I dont know the background of your users needs.
Consider that most users have terrible "eyes" for colors.

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top