I have a textarea submitted to a php file.
Im using this to make it look exactly as the user entered the text:
$ad_text=nl2br(wordwrap($_POST['annonsera_text'], 47, "\n", true));
If I want to resize a container I must be able to read how many lines are in the variable ‘$ad_text’.
Is there a way to do this…
I am still learning so thanks for your help…
You can use regular expression:
EDIT: Since you use nl2br so '
\n' is replaced by<br>. So you need this code.However,
<br>will not be display as newline in textarea (if I remember correctly) so you may need to removenl2br.Hope this helps.