Minimum/max character count?

Hey everyone,

I am trying to set a min/max char count on my Classifieds listings site but I am unsure of where to set these parameters. I can set a few fields in the AdminPanel but other fields such as Usernames and Price, I cannot. Do I do this in PHPmyAdmin? I thought I set it up but maybe I didnt do it correctly. Thanks! :slight_smile:

I would use a text field for the database.
In php I would use strlen() and make sure it is bigger than “x” and smaller that “y” before submitting.

It would also be nice to give them a javaScript counter so they know how many chars the have entered.

Not sure what you need as far as username and price.

I will do that! thanks…and for User name, I just dont want people signing up as “1” or “y”…and when they list something, I dont want them to put $44,000,000 for an item. Even though they all have to be approved, if there is a way to limit that, i would like to know for future reference as well! Thanks again


if (strlen($_POST['username']) < 10 && strlen($_POST['username']) > 3){
// good name, less than 10 chars long and greater than 3 chars
}
else{
// bad username
}

For prices, have them enter an amount, You supply the dollar sign


if ($_POST['price'] < 1000){
// good price
}
else{
// price is too high
}


Sweeet! Now I just have to figure out where it goes…I’m working with a template/Admin panel site along with a database using phpmyadmin.