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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.