I have this wonderful piece of code from here
But if some one edits the form through firebug or disable the js then this wont work, I want to have server side validation for this function, can anyone direct me to the right path please
I have this wonderful piece of code from here
But if some one edits the form through firebug or disable the js then this wont work, I want to have server side validation for this function, can anyone direct me to the right path please
The following php code will give you the number of new lines in the text data:
echo substr_count(nl2br($textdata), '<br />') + 1;
the use of nl2br()
is to support the different new lines formats (\r\n, \n\r, \n y \r)
Test:
$textdata = 'First line
second line
third line
fourth line';
$lines = substr_count(nl2br($textdata), '<br />') + 1;
echo $lines; //will output 4