hello folk
ive got a standard <textarea> that i am using to capture input. the intended input is large(ish) essays, that are made up of paragraphs of writing, which may inclue apostrophes and quotes.
im putting this captured data into my dbase in field of type text. the variable that stores the form's input is a string (in php).
everytime i try add quotes or apostrophes to my textarea and submit, it doesnt work. any idea how i am meant to capture this?
also, for paragraphs, i am typing <p> tags within my essay. is there anyway i can automate paragraphs based on spaces used in the textarea?
sort of like the input box i am using to type this very post.
"
'
etc.
(ive already posted this under client-side. i thought i'd post this here too, since it might be a php issue.)
capturing quotation marks and apostrophes in textarea input
Moderator: General Moderators
-
konstandinos
- Forum Commoner
- Posts: 68
- Joined: Wed Oct 04, 2006 4:20 am
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
-
konstandinos
- Forum Commoner
- Posts: 68
- Joined: Wed Oct 04, 2006 4:20 am
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
use var_dump() take a look at how the browser is encoding the POST data - that will allow you to reformat things like paragraphs, etc... Regular expressions might help auto-format things like headings, but it won't be perfect.
Alternatives are using pseudo-code (like bbcode or wikicode), or using a rich textarea like FCKeditor in the client side, then capturing the xhtml it produces.
If you're having issues with things like hyphens, you'll need to learn about character encoding (more specifically, Unicode) and how browsers handle the display and POSTing of different character encodings. It's a big subject, beware! Ultimately, using FCKeditor or one of it's contemporaries would likely skirt that issue, but they have a learning curve as well.
Cheers,
Kieran
Alternatives are using pseudo-code (like bbcode or wikicode), or using a rich textarea like FCKeditor in the client side, then capturing the xhtml it produces.
If you're having issues with things like hyphens, you'll need to learn about character encoding (more specifically, Unicode) and how browsers handle the display and POSTing of different character encodings. It's a big subject, beware! Ultimately, using FCKeditor or one of it's contemporaries would likely skirt that issue, but they have a learning curve as well.
Cheers,
Kieran
-
konstandinos
- Forum Commoner
- Posts: 68
- Joined: Wed Oct 04, 2006 4:20 am
mysql_real_escape_string and nl2br are working perfectly.
and for the occasional bold or italic phrase, i dont mind adding <strong> and <em> tags myself.
but now i only have one issue: when i try use <pre> tags to paste code, if i use nl2br i get an extra line after each line break in my code too. if i dont use the <pre> tags then i loose the indentation.
any suggestions would be appreciated. but thanks anyway for the help thus far.
and for the occasional bold or italic phrase, i dont mind adding <strong> and <em> tags myself.
but now i only have one issue: when i try use <pre> tags to paste code, if i use nl2br i get an extra line after each line break in my code too. if i dont use the <pre> tags then i loose the indentation.
any suggestions would be appreciated. but thanks anyway for the help thus far.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
any suggestions would be appreciated
I would recommend bbcode, like these forums useKieran Huggins wrote:Alternatives are using pseudo-code (like bbcode or wikicode), or using a rich textarea like FCKeditor in the client side, then capturing the xhtml it produces.