So I have this code:
else {
$strlen = json_encode(strlen($_POST['message']));
?>
<script language="javascript" type="text/javascript">
var length = <?php echo $strlen ?>
alert("Your message was too long (max 255 chars), yours was " + length);
</script>
<?php
echo "Your message was too long (max 255 chars)";
echo "Yours was " . $strlen . " charachters long";
}
... and It will just not display the alert box with the value of the actual strlen
of the string.
The "Yours was $strlen charchters long" works fine.
I have also tried removing json_encode()
, that did not either.