Jump to content

[SOLVED] Quotes


jaymc

Recommended Posts

<input type=text value="She said "It was cool" today">

<input type=text value='She said 'It was cool' today'>

 

Spot the problem?

 

Whats the best way around it, because when people are adding quotes in these boxes and its being inserted into a database then pulled back out for inclusion in a text field, its causing issues where as the outputted value is

 

She Said

 

Please advise

Link to comment
https://forums.phpfreaks.com/topic/64162-solved-quotes/
Share on other sites

Its always best to not destroy the original input because its the author's work.  punctuation is aways tricky because it can be interpreted as text strings or in some cases as literal programing punctuation.  The best idea is look into the add/strip slashes functions and the escape for mysql these functions escape\unescape all special characters for use and then simply apply them on insertion and then remove on viewing.

Link to comment
https://forums.phpfreaks.com/topic/64162-solved-quotes/#findComment-319752
Share on other sites

The issue is not with it screwing up mysql

 

Its the HTML

 

value="test "quote here" more convo"

 

As far as the HTML engine in concerned the value is

 

value="test "

 

Thus leaving this redunt code to be interpreted as plain text

 

quote here" more convo"

Link to comment
https://forums.phpfreaks.com/topic/64162-solved-quotes/#findComment-319766
Share on other sites

Its always best to not destroy the original input because its the author's work.  punctuation is aways tricky because it can be interpreted as text strings or in some cases as literal programing punctuation.  The best idea is look into the add/strip slashes functions and the escape for mysql these functions escape\unescape all special characters for use and then simply apply them on insertion and then remove on viewing.

its been said by this guy thats why im knocking on the wring door  LOL

i guess time to mark this as solved

Link to comment
https://forums.phpfreaks.com/topic/64162-solved-quotes/#findComment-319814
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.