Unstoppable Domains

How do I give a text area max length in Php?

Spaceship Spaceship
Watch

JasMate

VIP Member
Impact
32
Here is the code: ProductName varchar(50) NOT NULL default '',

The problem is people can still type in heaps of characters after the "50". I would like it to be so they can't type anymore after the "50". How do I do this?

Thanks for helping.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
0
•••
Like iNod said you can't actually limit the textarea with php however you can validate the input after submission. It's just a bit better than storing only 50 charactors of the input and not telling the user.

PHP:
if( strlen($_POST['textarea']) > 50)
{
    echo 'You entered too many characters!';
}
 
0
•••

We're social

Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back