Forum Moderators: coopster
<td><textarea name="Who_Now" rows="4" cols="50" MaxChars="750" id="text1" onkeypress="if (this.value.length >= parseInt(this.attributes['MaxChars'].value)) return false;" onkeyup=" document.getElementById( this.id+'_charsCount' ).innerHTML = (parseInt(this.attributes['MaxChars'].value)-parseInt(this.value.length))+' characters left.';"></textarea><br><span id="text1_charsCount">750 characters left</span></td> Then I receive the info on the confrimation page:
$webinfo13=mysql_real_escape_string($_POST['Who_Now']); Now if the form doesn't pass, I am trying to echo the info back into the textarea:
<textarea name="Who_Now" rows="4" cols="50"><?php echo stripslashes(htmlspecialchars($webinfo13); ?></textarea> However the output is not what was typed if the user typed quotes into the textarea....? It works on the input fields but not in the textarea?
Any help?
Consider this:
$a = "I say, \"How's it going\", what's up?";
$a = addslashes($a);
$a = addslashes($a);
$a = stripslashes($a);
echo $a;
will produce this:
I say, \"How\'s it going\", what\'s up?
Because you've added slashes twice and removed them once. stripslashes():
Returns a string with backslashes stripped off. (\' becomes ' and so on.) Double backslashes (\\) are made into a single backslash (\).
Although you're using mysql_real_escape_string to add the slashes, it has the same result:
$webinfo13=mysql_real_escape_string($_POST['Who_Now']);
stripslashes(mysql_real_escape_string($webinfo13));