Forums

Problem database entry (special chars ",' -->data not saved)

Burner 12 Nov, 2009
Hi all,

I have a problem with my database entry. The form I created works just fine, but whenever the user enters a " (quotation mark) in one of the text areas the database entry stops and cuts everything that follows. I think that's because the " is interpreted by mysql.

How can I change that? addslashes function?

Thanks very much.
GreyHead 12 Nov, 2009
Hi Burner,

I don't have time to hunt it down right now but this has come up once before here. A Google search of the forums might find the thread, it was more than six months ago IIRC.

Bob
Burner 13 Nov, 2009
Thanks Bob. I searched the forums and found two approaches:

This one

I changed the Autogenerated code to read "'".addslashes($_POST['textarea_1'])."'"



and this one:

The $_POST['field_name'] code was for Joomla 1.0.x (though it should still work in Joomla 1.5).

Each entry is like this

Code: Select all
'".JRequest::getVar('nom','', 'post', 'string', '' )."'

you can replace this with

Code: Select all
'".addslashes(JRequest::getVar('nom','', 'post', 'string', '' ))."'

Notice the )) near the end.





Appreciating your help very much
Burner
Burner 16 Nov, 2009
OK. I just learned that I cannot change the autogenerated code. What can I enter in the OnSubmitCode to apply addslashes? any suggestions?
thanks
Burner 16 Nov, 2009
Thanks! I've found the mistake by now. The configuration page was responsible for the error. No need to add addslashes etc...
This topic is locked and no more replies can be posted.