Monday, December 20, 2010

The " problem in string handling

I landed up with a very strange problem recently. The objective was very simple. I was trying to read some text from the mysql database and display it in a input element inside a form for editing.
The code looked something like this:

Where I have read the $data variable from the sql database.
Now the problem is, if the $data is a simple string, like
hi there, how are you
then the above code works fine as:

but when the data that was imported from the sql table was something like
"hi there, how are you"
Then what I get in the form is this:

The reason being obviously the clash of the quotation marks " in the data with that in the
input tag format.
I am still trying to figure a way out. Can anyone please help?

[EDIT]
Ok so i found the solution to this problem here.

No comments:

Post a Comment

Recent Articles