Code: Select all
<form>...
Please write any comments, questions, or suggestions you may have below (max 500 characters).<br>
<input onblur="textCounter(this.form.recipients,this,500);" disabled onfocus="this.blur();" maxlength="3" size="3" name="counter" value="500" > Remaining characters<br>
<textarea onblur="textCounter(this,this.form.counter,500);" onkeyup="textCounter(this,this.form.counter,500);" id="comments" rows="5" cols="90" name="comments">
<?php
$comments;
?>
</textarea>
...
</form>
Code: Select all
/*------- users input textbox -------------------------------------------------*/
if (empty($_POST['comments']) != TRUE)
{
$_POST['comments'] = preg_replace('/[^a-zA-Z0-9\'.\s]/', '', $_POST['comments']);
$_POST['comments'] = strip_tags($_POST['comments']);
$_POST['comments'] = stripslashes(htmlspecialchars($_POST['comments']));
$_POST['comments'] = trim($_POST['comments']);
$comments = $_POST['comments'];
}