f



trouble formatting text

Hi, I'm having trouble using the proper terminology, so bear with me,
I am trying to submit text to a mysql database. I want to be able to
allow formatting of this content (like breaking it up into
paragraphs). I am sending the data to the server via ajax, and so
escape the characters.

When I read back the information on my news page, all of the
formatting is gone. Do I need to unescape the charachters somehow
using javascript or php?

Any help is appreciated
0
rozmaha (12)
12/21/2007 4:49:27 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

2 Replies
364 Views

Similar Articles

[PageSpeed] 57

Rozzy <rozmaha@gmail.com> wrote in news:50f642c7-8efd-4e4b-8234-
c4fc752bb8d2@21g2000hsj.googlegroups.com:

> Hi, I'm having trouble using the proper terminology, so bear with me,
> I am trying to submit text to a mysql database. I want to be able to
> allow formatting of this content (like breaking it up into
> paragraphs). I am sending the data to the server via ajax, and so
> escape the characters.
> 
> When I read back the information on my news page, all of the
> formatting is gone. Do I need to unescape the charachters somehow
> using javascript or php?
> 
> Any help is appreciated
> 

What is your definition of "formatting"?  Line breaks?  If so, are you 
calling nl2br('databasevalue') before printing to the page?
0
heyho (434)
12/21/2007 5:13:44 PM
..oO(Rozzy)

>Hi, I'm having trouble using the proper terminology, so bear with me,
>I am trying to submit text to a mysql database. I want to be able to
>allow formatting of this content (like breaking it up into
>paragraphs). I am sending the data to the server via ajax, and so
>escape the characters.
>
>When I read back the information on my news page, all of the
>formatting is gone. Do I need to unescape the charachters somehow
>using javascript or php?

If the text was entered in a text area for example, then of course it
only contains normal line breaks. If you want to print it out as HTML,
then you either have to call nl2br() (be aware that it returns XHTML)
or - better - replace the line breaks with proper 'p' elements.

Micha
0
netizen9200 (1826)
12/21/2007 9:06:05 PM
Reply:

Similar Artilces:

Format text coming from PHP
I've this code in PHP: $info = "\r---------------------------- \rVersion: ".$row_RecordsetDetail->VersionName. "\r1�re mise en circulation: ".$row_RecordsetDetail->FirstRegistration. "\rPrix: ".$row_RecordsetDetail->SellPrice. "\r----------------------------"; ... <input type="hidden" name="Information" value="<?php echo($info);?>"> now, on javascript, I've this: w=window.open('contactseller.php?annID='+document.Contact.AnnID.value+'&Info rmation='+document.Contact.Information.value ,'null','resizable=no, location=no, top='+((window.screen.height/2)-50)+', left='+((window.screen.width/2)-150)+', width=300, height=100, menubar=no, status=no, scrollbars=no, menubar=no'); The result for the info part is on one line (not with return like it's done in $info). I've also tried with \n, but it doesn't work either. My PHP function show this text and the \r or \n seems to disappear... Any idea on how to fix this ? BoB ...

Coverting php text string to mysql data format ?
I have a string in a existing php script which is in the form "dd/mm/yyyy" and I need to convert it into a suitable format for mysql which is "yyyy-mm-dd" Is there a neat way of doing this in php ? On 26 Jun, 15:23, "Tony B" <tag...@yahoo.co.uk> wrote: > I have a string in a existing php script which is in the form "dd/mm/yyyy" > and I need to convert it into a suitable format for mysql which is > "yyyy-mm-dd" Is there a neat way of doing this in php ? Do it in MySQL instead. Look at the DATE_FORMAT function in the MySQL manual: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format Furher questions of this sort should be in comp.databases.mysql Tony B schreef: > I have a string in a existing php script which is in the form "dd/mm/yyyy" > and I need to convert it into a suitable format for mysql which is > "yyyy-mm-dd" Is there a neat way of doing this in php ? > > Hi, I always do this 'by hand', eg: $orgDate = "22/06/2008"; $partsArr = explode("/",$orgDate); $newDate = $partsArr[2]."-".$partsArr[1]."-".$partsArr[0]; If you think the above method sucks, you can also do this: You can also make a Unix Time Stamp of the original date, and use date() to parse it to a format you need: parse a date to UTS: http://nl.php.net/manual/en/function.strtotime.php date: http://nl.php.net/man...

format bold text in a text box
I have a text box with this: =" Your name is: " $ [Name] $ " and last name is " $ [Lname] I want ONLY the [Name] and [Lname} to format bold and the other text not. Could I do this? You would needt use an RTF control for this. Hav a look at http://www.lebans.com/richtext.htm -- Terry Kreft "yiannis" <postnews@freemail.gr> wrote in message news:eeatc8$oql$1@volcano1.grnet.gr... > I have a text box with this: > =" Your name is: " $ [Name] $ " and last name is " $ [Lname] > > I want ONLY the [Name] and [Lname} to format bold and the other text not. > > Could I do this? > > ...

Rich Format Text looses formatting
When composing a message with RFT, like a table, the msg is sent correctly and can be viewed as composed by the receiving corresponden, but the msg stored in de 'sent' folder has lost the table formatting and the table is transformed in flush right commands for every cell entry. Is this problem known and will there be a solution in the new release? I didn't see anything about this in the news about the beta releases. -- <a href="http://users.kbc.skynet.be/fi001005">Belgische Ardennen Belges</a> Nu speelt: Rolling Stones - Under My Thumb (Ac...

Trying to store and retrieve formatted text from MYSQL using PHP
I am trying to store formatted text (windows format) into a MySQL database and then retrieve it. The field in the database is a varchar. I cut and paste the test into a form field formatted, then call the PHP program to add the record using POST. When I get the text out, it has lost it's formatting. Formatting in the text is achieved by multiple spaces not tabs, but even multiple spaces are converted to a single space and the carrage return/line feeds are lost. Below is the basic code I am calling when I click POST in the form. I would really appreciate advice on how I can make this ...

How to select all texts of the document of the format of the selected text?
Hi,i have selected a text of the document with the specified font face, color and size in MS Word 2000. Now , I want to select all the relevant texts from the entire document with the same format(face,color and size) as of the selected text. so Is there any method or shortcut to do this op.? Not really. You have to "walk" the document checking the styles as you go along. And You have to watch out for cases where the style changes in the middle of a word (!) and code accordingly to get the desired results. chetan26nov@gmail.com wrote: > Hi,i have selected a text of the document with the specified font face, > color and size in MS Word 2000. Now , I want to select all the relevant > texts from the entire document with the same format(face,color and > size) as of the selected text. > so Is there any method or shortcut to do this op.? ...

Trouble with viewable ascii text in text files...
Trying to input ascii codes such as A..B..C..etc into a file Then read that file and shift each Ascii char by a multiple like *2 or *3...Then take the new string and output to yet another file as my encoded/encrypted file. Then reading that file and converting back to the original string. Problem is many ascii chars are unreadable in a text file and simple truncate to ???????? making it impossible to reverse the numbers or text. Should I be using some kind of encoding of the ascii before outputing to the 1st file? If so, could one of you explain how to encode ascii to ___? and a way to reverse the process Back To ASCII in a file? I'm lost....thanks Robert Blass wrote: > Problem is many ascii chars are unreadable in a text file and simple > truncate to ???????? making it impossible to reverse the numbers or > text. Nope, that doesn't happen. Your program has an error. Either you're talking about the 2nd file, because if you multiply ASCII by an integer you'll surely get something unreadable back, or you've just plain messed up. If you're trying to read the second file, then use bytes (or ints) so you can read binary. Please post an SSCCE that shows the problem. On Wed, 01 Oct 2008 11:52:26 -0400, Robert Blass <blame@messenger.xcx> wrote, quoted or indirectly quoted someone who said : >rying to input ascii codes such as A..B..C..etc into a file >Then read that file and shift each Ascii char by a multiple like *2...

How to transfer text format to date and time format
I have a text string A as "3/9/2006 1:21:00 PM". I want to compare A wich Now(). Is there any function to transfer A to date and time format? Thanks. Mindy Mindy wrote: > I have a text string A as "3/9/2006 1:21:00 PM". I want to compare A > wich Now(). Is there any function to transfer A to date and time > format? Thanks. > > Mindy CDate("3/9/2006 1:21:00 PM") ....will convert it to a date using the "short date" format as defined in your regional settings in Control Panel. -- I don't check the Email account attached to this message. Send instead to... RBrandt at Hunter dot com ...

text formatting on different sources in an unbound text box
Howdy all, I have an unbound text box in a report with the following control source: =[genus] & " " & [epithet] & " " & [taxa_author] What I am trying to do is italicize the [genus] and [epithet] parts but not the [taxa_author] part. I have played around with this for a while, but to no avail. I can probably write a macro to do it, but was wondering if there was a more straightforward way to accomplish this. Any suggestions would be greatly appreciated. Thanks! Jeff Hollister -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 In a normal TextBox the font applies to the whole string. To change individual elements of the string you'd have to use a Rich Text Format (RTF) Text Box. This control is available in the Access Developer's Edition (for the Access version you are using). I believe Tony Toews has a version on his website. -- MGFoster:::mgf00 <at> earthlink <decimal-point> net Oakland, CA (USA) -----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv iQA/AwUBQJkj9oechKqOuFEgEQKs8gCglR2k4o3YvHh5bWsLAiZ+gtW53OIAoPT7 yxjbpMZafVXnNJ/Ec/qCcLCW =X4nC -----END PGP SIGNATURE----- Jeff W. Hollister wrote: > Howdy all, > > I have an unbound text box in a report with the following control > source: > > =[genus] & " " & [epithet] & " " & [taxa_author] > > What I am trying to do is italicize the [genus] and [epithet] parts >...

Parsing and formatting text, Text::Beautify and/or similar modules
Text::Beautify seems to do a good job. It will just capitalize the first word of each new sentence though. Is their any known way to reformat "ALL CAPS" text and capitalize proper names as well. Starting from scratch it seems like it would take an enormously complicated dictionary. This may be too much to hope for. Thanks On Dec 2, 11:25 am, jbl <jbl0...@SPAMhotmail.com> wrote: > Text::Beautify seems to do a good job. > It will just capitalize the first word of each new sentence though. > > Is their any known way to reformat "ALL CAPS" text and capi...

Failed opening required 'PEAR.php' (include_path='F:\www\include') in F:\Program Files\PHP\PEAR\Text\CAPTCHA.php on line 22
Hi, Guys=EF=BC=8Cwhen I run my site ,I got some errors: Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in F:\Program Files\PHP\PEAR \Text\CAPTCHA.php on line 22 Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path=3D'F:\www\include') in F:\Program Files \PHP\PEAR\Text\CAPTCHA.php on line 22 It appears that it cann't find the pear.php ,but i checked my dir,and this file was there,and also I have my php.ini file checked,the include_path=3Dinclude_path=3D".;F:\Program Files\PHP\pear;F:\www \include" ,it looks all right,was there anything I have missed in the config file?Or something wrong ? Wish somebody can help me out. Thanks, Mikay >Warning: require_once(PEAR.php) [function.require-once]: failed to >open stream: No such file or directory in F:\Program Files\PHP\PEAR >\Text\CAPTCHA.php on line 22 >Fatal error: require_once() [function.require]: Failed opening >required 'PEAR.php' (include_path='F:\www\include') in F:\Program Files >\PHP\PEAR\Text\CAPTCHA.php on line 22 So where is the pear.php file? >It appears that it cann't find the pear.php ,but i checked my dir,and >this file was there,and also I have my php.ini file checked,the >include_path=include_path=".;F:\Program Files\PHP\pear;F:\www >\include" ,it looks all right,was there anything I have missed in the >config...

text format
after scanning a document and transferring to Microsoft word the format is not the same.i am using omni pro11.any suggestions Graeme In article <413042b8$0$11963$afc38c87@news.optusnet.com.au>, limbclan@optusnet.com.au says... > > >after scanning a document and transferring to Microsoft word the format is >not the same.i am using omni pro11.any suggestion In OmniPage Pro, when you are saving the file, and have selected your output file type there, like for Word, then you can specify format choices in the Formatting Level field right below the file type fi...

trouble with formats
Dear All, sorry to bother you with such a vague problem, but once again I'd like to have your view om formats... I have made a format to change a 3-letter code to the proper name. When I run; OPTIONS fmtsearch=(fmatspec sasuser); LIBNAME fmatspec '~sieto/sasformat9'; PROC FORMAT PAGE LIBRARY=fmatspec FMTLIB; RUN; I get a perfect overview what is in the format, and spec_nl is one of the formats in there. But when I try to apply the format with: spec2=PUT(spec, spec_nl.); then I got ERROR 48-59: The format SPEC_NL was not found or could not be loaded. so the format is nog w...

text formatting
I have a field of text imported from an old database which has markup tags for italic <I> etc. I want to remove these and actually style the text in the filemaker layout. Also it would be nice for users if I could have buttons for Bold, Ital, and especially SmallCaps as there is no keyboard shortcut for this. It seems to be impossible to script anything like this. So, does anyone know if there is a plugin that could do it? And the reverse too... styled text to marked-up text. thanks Alan Hello Alan: Possibly you will find some help at www.tekstotaal.comc.fmp.font.grabbing.html ...

PHP trouble
Hi, I'm trying to use PHP to to a lot of repetetive work for me on a site. I've gotten most of it working fine - EXCEPT: the PHP is generating a table. It's looping through a CSV file until it reaches the end. Each row is a product that one can buy. I'm trying to make the last column of the table a customized paypal button based on the current variables. To do this I've tried two different things. 1. Break the php code and insert the HTML form (remember though, this HTML break is inside a for loop) and use <?php [variable] ?> to insert the variables where I need them. 2. DON'T break the code and echo the form. and delimit the quotes. I've isolated variables out of the problem...delimiting...everything. it all works outside of the loop. Does php not work in a loop? I'll post code for anyone intersted On Feb 3, 12:29 pm, AceX <AceIncorpora...@gmail.com> wrote: > Hi, I'm trying to use PHP to to a lot of repetetive work for me on a > site. I've gotten most of it working fine - EXCEPT: > > the PHP is generating a table. It's looping through a CSV file until > it reaches the end. Each row is a product that one can buy. I'm > trying to make the last column of the table a customized paypal button > based on the current variables. To do this I've tried two different > things. > > 1. Break the php code and insert the HTML form (remember though, > this HTML break is ins...

Formatted Text
Hi, I have a VB 6 application running of SQL2000. All reports generated from the app is done in Crystal and then exported as well. My problem is that I need to created a free flow type report with formatted text that is then exported and displayed in a Crystal report. Formatting will include basic bullets, tabs, bold, underlined and so on. The problem is that when you use Crystal, the information first needs to be saved in the database and then displayed. I dont know of any other meathod. Secondly, what control can I use in VB6 to capture the text from the user and give them the ability to format the text and then displey it in the same manner in Crystal. Thanks Elmo ...

Formatted Text
Is it possible to store formatted text into a memo field. From for example Visual Basic? The text box in Access is not capable of displaying some of the text formatted differently from other parts in the same box. You could use a Rich Text Box to display text that is stored in a memo field as rich text. Stephen Lebans has one you can download at www.lebans.com. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Erick" <HVL62@hotmail.com> wrote in message news:cof8u4$6ti$1@reader13.wxs.nl... > Is it possible to store formatted text into a memo field. From for example > Visual Basic? ...

Trouble passing JS parameter to PHP program /or/ executing the PHP
Taken from a couple very similar samples on the net, I'm having trouble passing a parameter to a PHP file. Here's all the JS code ... it creates an image object and modifies it's src to make a 'call' to the PHP file: var myobj = new Image(); myobj.src = 'http://www.mypage.com/my.php?url=' + 'anything_here'; The process seems to recognize that the file URL ends at the "?", and system logs show that the GET of the PHP file was successful. However, it doesn't seem to execute the PHP (internal debug logging does not occur). The PHP code it...

Formatting text.
Hi again :-) Is there any way to format a string. I.E. I've got a variable which may be 1, 2, 3 and the variable is added to string. I want to show whole string formatted as follows: 100 1 10 1100 not like that: 100 1 10 1100 Any help would be helpful (as always ;-) ) thanks in advance -- Posted via http://www.ruby-forum.com/. 2007/7/25, Marcin Tyman <m.tyman@interia.pl>: > Hi again :-) > Is there any way to format a string. I.E. I've got a variable which may > be 1, 2, 3 and the variable is added to string. I want to show whole > string formatted as follo...

text-text
Wondering how what I input to my UTF-8 terminal gets passed along through my patched [1] trn ... Cyrillic: А Б В Г Д Е Ж З И Й К Л М Н О П а б в г д е ж з и й к л м н о п IPA: ᴀ ᴁ ᴂ ᴃ ᴄ ᴅ ᴆ ᴇ ᴈ ᴉ ᴊ ᴋ ᴌ ᴍ ᴎ ᴏ ɀ Ɂ ɂ Ƀ Ʉ Ʌ Ɇ ɇ Ɉ ɉ Ɋ ɋ Ɍ ɍ Ɏ ɏ [1] https://groups.google.com/d/msg/comp.sys.raspberry-pi/7Z37Hdrm0DM/6aqD-reXFzAJ ...

formatting text
Hi, How do we format the particular text (i.e. colouring the text, keeping the text in bold letters etc.) in the output by using ods? For example, by comparing the two data sets by using proc compare, we get "No. of observations unequal is 0", if both the datasets are equal. To highlight this particular statement in the output ods pdf file, is there any way? If so, please suggest me. Thanks ...

Write Property Bag to Text file in Text format, not binary
Hi all I know that I can persist an object's data using the Property Bag in VB6 and MSDN includes the code sample listed below. However what I want to do is save to the text file in PLAIN TEXT Format, *not* as binary. I want to save the file so that it is human readable in the format: name of the property to save; the value to save (mInterestRate). However all the examples that I have found only show how to output the object as binary. Is it possible to write as plain text? Private pb As PropertyBag ' Declare a PropertyBag object. Private LoanObject As Loan ' Declare a Loan object. Private Sub Form_Unload(Cancel As Integer) Dim varTemp as Variant ' Instantiate the PropertyBag object. Set pb = New PropertyBag ' Save the object to the PropertyBag using WriteProperty. pb.WriteProperty "MyLoanObject", LoanObject ' Assign the Contents of the PropertyBag to a Variant. varTemp = pb.Contents ' Save to a text file. Open "C:\Loandata.txt" For Binary As #1 Put #1, , varTemp Close #1 End Sub Thanks for any help Andrew. It may not be what you are after but I always just set up a text file and write all the variables to a text file. sub form_unload() open "c:\app.path\variables.txt" for output as #1 print #1, loanrate print #1, etc close #1 end sub then in form load you do the reverse. ...

How to format a text file just like the RFC-text files?
I want to make some document go like these, what tools can help? Any help would be nice, thanks! BLIOGRAPHY ........................................... 34 APPENDIX A. EXAMPLES ............................................... 36 B. SIMPLE FIELD PARSING ................................... 40 C. DIFFERENCES FROM RFC #733 .............................. 41 D. ALPHABETICAL LISTING OF SYNTAX RULES ................... 44 August 13, 1982 - i - RFC #822 ^L Standard for ARPA Internet Text Messages PREFACE By 1977, the Arpanet employed several informal standards for the text messages (mail) sent among its host computers. It was felt necessary to codify these practices and provide for those features that seemed imminent. The result of that effort was Request for Comments (RFC) #733, "Standard for the Format of ARPA Network Text Message", by Crocker, Vittal, Pogran, and Henderson. The specification attempted to avoid major changes in existing software, while permitting several new features. The framework severely constrains document tone and appear- ance and is primarily useful for most intra-organization communi- cations and well-structured inter-organization communication. It also can be used for some types of inter-process commun...

formatting text
I have a script that generates reports and the reports are sent out via email. Problem is when opening and the reports using MS Outlook, the reports (text and chars) are no longer aligned. Is there a way on the unix side to format the report (unix2dos did not work for me) and viewed formatted on a PC client. Thanks :-) On 8/11/2003 1:30 PM, mags wrote: > I have a script that generates reports and the reports are sent out via > email. Problem is when opening and the reports using MS Outlook, the reports > (text and chars) are no longer aligned. Is there a way on the unix side to ...

Web resources about - trouble formatting text - comp.lang.php

Disk formatting - Wikipedia, the free encyclopedia
Disk formatting is the process of preparing a data storage device such as a hard disk drive , solid-state drive , floppy disk or USB flash drive ...

Gmail for Android gets rich text formatting & one-tap RSVPs for calendar invites
Google is announcing two notable new features for Gmail for Android today, including support for rich text formatting and a new “Instant RSVPs” ...

Paper by 53 gains app extension, new text formatting tools on iOS
... Extension so you can easily send images and notes from other apps directly to Paper. The app has also been updated with some new text formatting ...

Formatting « Above the Law: A Legal Web Site – News, Commentary, and Opinions on Law Firms, Lawyers ...
Above the Law: A Legal Web Site – News, Commentary, and Opinions on Law Firms, Lawyers, Law School, Law Suits, Judges and Courts

WhatsApp testing text formatting to include bold and italics in messages
The latest beta release of WhatsApp features some basic text formatting options including bold and italics. While features in beta versions of ...

Android Studio 1.2 Reaches Beta, Adds Built-In Decompiler, Inline Debugger Variables, Smarter Formatting ...
When Android Studio v1.1 entered the Stable channel, about 6 weeks ago, the Dev Tools team gave word that v1.2 was already well underway and ...

TextExpander 2.0 Brings Rich Text Formatting, Fill-In Snippets And More
TextExpander has finally received its big 2.0 update.

WordEver HD - Text Editor with Redesigned Keyboard and MarkDown syntax & formatting highlight
Holen Sie sich „WordEver HD - Text Editor with Redesigned Keyboard and MarkDown syntax & formatting highlight“ im App Store. Sehen Sie sich Screenshots, ...

Dolphin Text Editor Menu advanced formatting from most any Windows app
... and so on. Dolphin also provides various options to change the case of your selected text. It can clean up text by removing hidden formatting, ...

16 Tips on Blog Writing and Formatting
... again. My point is that you ought to take advice with a grain of salt. And that applies to this post as well. Writing blog posts and formatting ...

Resources last updated: 3/23/2016 7:04:22 PM