Jump to content

Apostrophes Ugh


Recommended Posts

So I've been having some issues with the displaying qualities. I'm fairly certain the issue is the html and css of MD rather than php, but here is a watered down version of what I'm having issues with:

html side
<form method="post" action="">
<textarea rows="20" cols="30" name="ApoProbs">
Add apostrophes or quotes in this box!!
<input type="submit" value="Submit!">
<--! content separator -->
<style type="text/css">
//This CSS is used to ensure that the pre will have wordwrap, rather than extending all the way off the page.
pre {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */

This in the MDS side
if (isset(@input['ApoProbs']))
echo str_replace("[[APOTESTS]]", @input['AproProbs'], @content[1]);
echo @content[0];

If you enter any apostrophes or double quotes in the textarea, they appear with backslashes when outputted. In the debug, however, there don't appear to be backslashes stored in the array. Strange!


It seems that even though the debug wasn't showing it, there were in fact backslashes being stored, which means that php automatically escapes ' and " when they are entered into the input. The solution is very simple:

if (isset(@input['ApoProbs'])){
@vt = stripslashes(@input['ApoProbs']);
echo str_replace("[[APOTESTS]]", @vt, @content[1]);
echo @content[0];

Thank you.


Edited by awiiya
Link to comment
Share on other sites

Apart from your code having multiple errors each rather basic.

I see nothing wrong as you described on yim.

I believe the issues you are having, is with the storages and such. Perhaps you can explain the issue better?

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Forum Statistics

    Total Topics
    Total Posts
  • Recently Browsing

    No registered users viewing this page.

  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

  • Create New...