Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
max characters variable
Old 09-26-2007, 04:56 AM max characters variable
Average Talker

Posts: 20
Trades: 0
Hello,

How can i add a max character limit to a variable?

So if the var the user inputs is too long, it stops the procedure. else, continue.

Thanks in advance
koolaid is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-26-2007, 05:13 AM Re: max characters variable
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
PHP Code:
if(strlen($var)>$limit){
  echo(
'naughty boy!');
  exit();
}
else{
  ....

Or in html, on the <input> tags, you have a "maxlength" attribute that specify the maximum number of characters the user can type.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to max characters variable
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.55110 seconds with 12 queries