SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member NickG's Avatar
    Join Date
    Jun 2013
    Location
    Ft.Lauderdale
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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!

  2. #2
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,099
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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.
    What I lack in acuracy I make up for in misteaks

  3. #3
    SitePoint Member NickG's Avatar
    Join Date
    Jun 2013
    Location
    Ft.Lauderdale
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  4. #4
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,099
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    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

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

    What I lack in acuracy I make up for in misteaks

  5. #5
    SitePoint Member NickG's Avatar
    Join Date
    Jun 2013
    Location
    Ft.Lauderdale
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •