Try putting a backslash \ directly in front of the quotes.
Look in the php manual about escape characters and how to use them to get different values. That's going to be the key to what you're doing. I've never done this before, but have a basic idea of how it would work.
Here is the idea as I understand it......
Get the passed in value from the submission form the user has filled out (the field that is likely to contain a quote).
Use some of the php string functions to parse the supplied value, and replace any occurances of " with \". Aslo note that when you specify to the php string function that it is looking for a " quote, you will have to specify this quote using the backslash first.
Also, when specifying that it should replace the quote with a "backslash-quote", you will also need to escape the backslash also by putting 2 back slashes side by side.
Not sure of the exact php function you'd use to make the replacement, but here' s a general idea of how it may be written.
Ex: replace($passed_string, "\"", "\"");