I've got a form field that is filled with data from MySQL. The form is an editor of previously recorded data.
I just realized that it does not work when someone uses quotation marks in their entry.
If the Title was "My Fair Lady" presentation, the HTML would look like:
This HTML results in a blank field because the browser sees 2 quotation marks next to each other.
If I change the PHP to:
(removing the escaped quotation marks) then presentation does not appear in the text field.
Can anyone recommend a way around this? Should I simply deny the ability to use quotation marks when the data is first entered?
It seems that single quotes are fine. How do I replace double quotes with single quotes when the data is first entered? The following does not work...
- - picklefish - -
Why is everyone in this forum responding to me as picklefish?
Code:
<INPUT name=changeTitle value=\"$Row[Title]\">
I just realized that it does not work when someone uses quotation marks in their entry.
If the Title was "My Fair Lady" presentation, the HTML would look like:
Code:
<INPUT name=changeTitle value=""My Fair Lady" presentation">
If I change the PHP to:
Code:
<INPUT name=changeTitle value=$Row[Title]>
Can anyone recommend a way around this? Should I simply deny the ability to use quotation marks when the data is first entered?
It seems that single quotes are fine. How do I replace double quotes with single quotes when the data is first entered? The following does not work...
Code:
$newTitle = preg_replace ("\"", "\'", $_POST[newTitle]);
- - picklefish - -
Why is everyone in this forum responding to me as picklefish?