SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2004
    Location
    Boston
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Textfields and size restrictions

    Does anyone know if an HTML form textfield has a character cap?

    I think a MYSQL DB text field has a limit of 4000 characters. I need to know if there is a maximum amount of characters allowed for a textfield and also for the PHP/HTML form POST method.

    Thanks

  2. #2
    SitePoint Evangelist LemoNade's Avatar
    Join Date
    Aug 2005
    Location
    Southampton, UK
    Posts
    500
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, I don't think there is. I think there are ways to limit it using Javascript, or you could use PHP's substr() to cut it off at a certain limit after the form has been submitted.

    -Will

  3. #3
    SitePoint Guru LinhGB's Avatar
    Join Date
    Apr 2004
    Location
    Melbourne, Australia
    Posts
    902
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    substr() could be a problem when you want to have a WYSIWYG editor for HTML inputs. Just use JS to check the limit and if exceeded (and user somehow forces it to continue) just empty the input string in PHP.

  4. #4
    SitePoint Evangelist
    Join Date
    Apr 2004
    Location
    Boston
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the info. I just need to be able to dump like 5 or 6 pages of text into it and wasn't sure if it would take it.


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
  •