Jump to content

String length validation not working


thefollower

Recommended Posts

For some unknown reason my validation is not working on the string length, not sure what I have done wrong but it just doesn't header out. Have i got the syntax wrong or something?

 

Hope you can help!

 

 

<?php
$MessageText = 0;
If(strlen($MessageText) > 255 OR strlen($MessageText) < 10 OR $MessageText == ''){
Header("location: composeletter.php?toolongmessage");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/88722-string-length-validation-not-working/
Share on other sites

it just doesn't header out.

 

You mean it doesnt forward? Echo something (I usually use echo "here") before the header to confirm that you are even entering that part of the conditional. If you are, then check and make sure you have absolutely NO output to the page before that point (including spaces at the end of include files or what not), as that will prevent the header from working. Those random spaces can be hard to track down...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.