How to remove multiple empty lines (spaces) entered by user
Posted: Mon Jan 29, 2007 11:10 am
Script URL: http://gabsal.100webspace.net/testingbook/gbook.php
Version of script: 143
Hosting company: http://www.100webspace.com/
URL of phpinfo.php: http://gabsal.100webspace.net/testingbook/phpinfo.php
URL of session_test.php: http://gabsal.100webspace.net/testingbo ... n_test.php
What terms did you try when SEARCHING for a solution: spaces, multiple spaces, line breaks...
Write your message below:
Hi! I have 2 questions, (maybe they are the same):
Q1:
I would like to know if there is a way to avoid a user entering multiple empty lines. In other words: if a user enters something like this:
test
test
I would like to change it into this (turn n empty lines (spaces) into just one):
test
test
Q2:
Another problem is the following: If a user enters a lot of empty lines between words (see example here: http://gabsal.100webspace.net/testingbook/ ) Then a strange < br> tag appears and the end of the comments became bold (in the example I ONLY entered the word "test" at the first line and again the word "test" at the last line). Can that be avoided?
Thanks for your help.
[Maybe a way to avoid these problems would be to set a maximum number of characters that a user can enter in the text field, then that would refrain the user from doing this stupid input. If that is so, do you know how that can be accomplished?]
(Sorry if my questions look too naive; I am a php newbee and my mother tongue is not english!)
Version of script: 143
Hosting company: http://www.100webspace.com/
URL of phpinfo.php: http://gabsal.100webspace.net/testingbook/phpinfo.php
URL of session_test.php: http://gabsal.100webspace.net/testingbo ... n_test.php
What terms did you try when SEARCHING for a solution: spaces, multiple spaces, line breaks...
Write your message below:
Hi! I have 2 questions, (maybe they are the same):
Q1:
I would like to know if there is a way to avoid a user entering multiple empty lines. In other words: if a user enters something like this:
test
test
I would like to change it into this (turn n empty lines (spaces) into just one):
test
test
Q2:
Another problem is the following: If a user enters a lot of empty lines between words (see example here: http://gabsal.100webspace.net/testingbook/ ) Then a strange < br> tag appears and the end of the comments became bold (in the example I ONLY entered the word "test" at the first line and again the word "test" at the last line). Can that be avoided?
Thanks for your help.
[Maybe a way to avoid these problems would be to set a maximum number of characters that a user can enter in the text field, then that would refrain the user from doing this stupid input. If that is so, do you know how that can be accomplished?]
(Sorry if my questions look too naive; I am a php newbee and my mother tongue is not english!)