strlen help.

Discussion in 'PHP' started by x0x, Sep 21, 2008.

  1. #1
    I have a textarea where the users submit info. After they submit it, it goes into the database.

    What I need is to make something to limit the text to 500 characters.

    It should not give them any errors, it should submit the data BUT cut off everything after the 500 character point. Something short and simple as possible, the code is very heavy already :p
     
    x0x, Sep 21, 2008 IP
  2. hamidof

    hamidof Peon

    Messages:
    619
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    $user_text = substr($user_text, 0, 500);
    
    PHP:
    :)
     
    hamidof, Sep 21, 2008 IP
  3. x0x

    x0x Well-Known Member

    Messages:
    510
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Thank you :)
     
    x0x, Sep 21, 2008 IP