Limit the length of a text string being entered into a database

Limit the length of a text string being entered into a database
Description

This can be used if you want to limit a string, for example if you want to limit the length of user inputted text that is being saved to a database.
The code





if (strlen($text) > "255") {



exit("The text you entered is too long.");



}



?>

Posted in |