Skip to content
View in the app

A better way to browse. Learn more.

MagicDuel Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Apostrophes Ugh

Featured Replies

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
[code]
<form method="post" action="">
<textarea rows="20" cols="30" name="ApoProbs">
Add apostrophes or quotes in this box!!
</textarea>
<input type="submit" value="Submit!">
</form>
<--! 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+ */
}
</style>
<pre>
[[APOTESTS]]
</pre>
[/code]

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

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!

[b]SOLUTION[/b]

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:

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

Thank you.

Awi

Edited by awiiya

Guest
This topic is now closed to further replies.

Forum Statistics

  • Total Topics 17.5k
  • Total Posts 182.2k

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.