How can I enter formatted text to LONGTEXT field in MySQL database?
I would like to store text in a LONGTEXT field with formatting. I'd like to have the first couple of words in a paragraph in bold like subheadings. It's for property details, so what I'm trying to achieve is this sort of thing:
Living Room: a;kdsfa;kdljfa;kdsjfa;kldfj;aklsdjfa;klsdjfa;ksdf;aklsdjf;aklsdjf;askldfj;aklsdjf;aksldfj;askdfj;aklsdjfa;skldfj;alksdfj;aklsdfja;ksldjf;alskdjf;askldjf;aklsdjf;asldkjf;asdklfj;asdklfj;asdklfja;dskflja;dkfj.
I copied my text from my text program with the formatting but the formatting hasn't been stored. I suppose to store it this way, I'd have to use the HTML tags around the words I want to format. This is something I'd rather avoid as I want non-HTML users to be able to add the data.
It might be that I can do this through my Coldfusion forms, which I'm using to connect to the database and populate aspects of the web pages, but I wondered whether that would achieve what I want or whether the non-HTML users would still have to know to enter the tags around the words to be formatted?
Alternatively, perhaps, I could use CSS to specify that the first line be in bold? Also not sure how that would output with the ParagraphFormat() function with Coldfusion - i.e. not sure whether this would mean that only the first line of the first paragraph would be put into bold, or whether it would translate to all the paragraphs. That would still be limiting, anyway, as it would mean each 'room' detailed for the property would need to have all its details only in one paragraph, which might be ok but, again, might not be what the users want.
I thought it would take me ages to work this out, but I have solved my own problem.
Just in case anyone else doesn't know this,
On my ColdFusion forms, I can use <cftextarea> instead of <textarea>. This means I can specify richtext="yes" within the cftextarea tag and get a format bar above my field - just like the one in this posting window. This has meant that I can drop down a styles list and choose Heading 3, which is the appropriate heading tag for this content on my page, and when the page is loaded with the details from the database, I now get the sub-headings for each of the rooms in the <h3> format as per the stylesheet. I could have chosen just to use the B button to make them bold but if I was typing in the details for the page myself, I'd be using the <h3> tag anyway, so this is ideal.
Next time I'll make sure I check it out more before I post, but hopefully this might be useful for others.