How to limit form field input?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony Brinton

    How to limit form field input?

    I'm a beginning PHP programmer. I'm wondering if there is an easy way to
    limit a user's input in a text field to 1000 characters?

    Thanks,

    Tony

  • Pedro Graca

    #2
    Re: How to limit form field input?

    Tony Brinton wrote:[color=blue]
    > I'm a beginning PHP programmer. I'm wondering if there is an easy way to
    > limit a user's input in a text field to 1000 characters?[/color]

    After the user sends his textfield (whatever the length) you can cut
    that into the first 1000 characters:
    $limited = substr($_POST['textfield'], 0, 1000);


    If you want to limit at the client side, there's always the unreliable
    option of using JavaScript.
    --
    --= my mail box only accepts =--
    --= Content-Type: text/plain =--
    --= Size below 10001 bytes =--

    Comment

    • rostik

      #3
      Re: How to limit form field input?

      "Tony Brinton" <tony@morris-design.com> wrote in message
      news:BC4522C7.8 18%tony@morris-design.com...[color=blue]
      > I'm a beginning PHP programmer. I'm wondering if there is an easy way to
      > limit a user's input in a text field to 1000 characters?[/color]

      <input type="text" maxlength="1000 0">


      Comment

      Working...