What the hey?
I have found that when I submit a form with a text box that contains a string that includes an apostrophe ('), when the string is printed on the submit page that apostrophe is escaped (\')! I didn't tell it to do that as I am not going to be storing this data in a database so why would I want them escaped?
Can someone please tell me why PHP is doing this, it is infuriating.
I whipped up a test page to illustrate, just enter a string with an apostrophe into one or both of the boxes and hit Submit. Then press submit again and watch them grow!:
I have found that when I submit a form with a text box that contains a string that includes an apostrophe ('), when the string is printed on the submit page that apostrophe is escaped (\')! I didn't tell it to do that as I am not going to be storing this data in a database so why would I want them escaped?
Can someone please tell me why PHP is doing this, it is infuriating.
I whipped up a test page to illustrate, just enter a string with an apostrophe into one or both of the boxes and hit Submit. Then press submit again and watch them grow!:
Code:
<html>
<body>
<form name="mainForm" id="mainForm" method="post" action="test.php"><br>
<textarea name="body" rows="8" style="width: 450px;"><? if (isset($_POST['body'])) echo $_POST['body']; ?></textarea><br>
<input name="subject" id="subject" type="text" style="width: 450px;" value="<? if (isset($_POST['subject'])) echo $_POST['subject']; ?>"><br>
<input type="submit" value="submit">
</form>
</body>
</html>