input type=text maxlength=300
I think the attribute is called maxlength but i'm not sure, oh well add the
maxlength attribute to your input tag to have a quick, clean
non-javascript-realiant solution
On 1/12/06, John Meyer [EMAIL PROTECTED] wrote:
Stut wrote:
Ok, you're clearly missing my
Hello,
I need to check that user input text is less than 300 characters long. How?
Thanks
-Will
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[snip]
I need to check that user input text is less than 300 characters long. How?
[/snip]
string length, it's in the manual.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
William Stokes wrote:
Hello,
I need to check that user input text is less than 300 characters long. How?
Thanks
-Will
Try with strlen:
http://php.net/strlen
Silvio
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I need to check that user input text is less than 300 characters
long. How?
if (strlen($_POST['input']) 300) { ...
You may want to also apply trim() to the input text to get rid of
extraneous white space at the beginning and end of the input.
Larry
--
PHP General Mailing List
On Thu, 12 Jan 2006 16:56:43 +0200
William Stokes [EMAIL PROTECTED] wrote:
Hello,
I need to check that user input text is less than 300 characters
long. How?
if(strlen($UserInputText) 300){
echo(Too long);
}
See http://www.php.net/manual/en/print/function.strlen.php
Regards,
Hmm.. I didn't see anyone ask before or after the user clicks SUBMIT?
If it's before, then you should use javascript to check the form element prior
to submitting (you can check realtime with the onkeydown, onkeyup events...
check after a user moves off of the form element with onchange or
[EMAIL PROTECTED] wrote:
Hmm.. I didn't see anyone ask before or after the user clicks SUBMIT?
Probably because this is a PHP list and nothing that happens on the
client side is a) controllable by PHP or b) guaranteed. Whatever you do
on the client side you should always validate
[EMAIL PROTECTED] wrote:
I disagree... PHP frequently involves interacting with or outright using
alternative technologies to accomplish your goal. This includes HTML, XML,
databases, etc. To effectively use PHP you need to understand your options and
the pros/cons in using the other
Stut wrote:
Ok, you're clearly missing my point and while I don't want this to
degrade into the usual pissing contest I do feel I need to clarify
what I was saying.
I completely agree that in this case Javascript should be used to
provide the user with feedback as to how close to the limit
Hi all. A quick question as an extension to the threads about input
validation over the past weeks.
It's obviously best practice to rigorously check and validate all input
coming via $_GET or $_POST, but what about $_SESSION values?
Without proper checking of $_GET and $_POST, it is very easy
--- Pablo Gosse [EMAIL PROTECTED] wrote:
It's obviously best practice to rigorously check and validate all input
coming via $_GET or $_POST, but what about $_SESSION values?
Session data can be considered safe, but there are of course caveats. It
is not possible for the user to manipulate
12 matches
Mail list logo