I have a form where the user can input questions and answers for tests. When the user clicks the submit button on the form, the information in the form is POSTed to the following script:
<?php
if (isset($_GET["test"])) {
$TestFile = fopen("../tests_hidden_away/" . $_GET["test"] . ".txt", "w") or die("The test could not be created.");
$counter = 0;
while ($counter < 25) {
$CorrectQANDA = trim($_POST["q" . $counter]);
fwrite($TestFile, $CorrectQANDA . "\r\n");
$counter = $counter + 1;
}
fclose($TestFile);
header("Location: administration.php?msg=The+update+was+successful!");
}
else {
header("Location: administration.php?msg=There+was+a+problem+with+the+update.");
}
?>
It seems to work fine, except that if the user types a quotation mark ( " ) in one of the input fields, the quotation mark is written differently. Here's an example:
My name is "Jason."
Would appear as this in the file:
My name is \&quot;Jason.\&quot;
Any ideas? Maybe something extremely obvious that I've been too blind to see?
Thanks in advance!
Jason