SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Jordan
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ddddddddd..? what is the solution

    if someone typed :
    dddddddddddddddddddddddddddddddddddddddddddddddddddd(*10)
    in a text field i think you'll have a bad result

    what is the solution?by useing PHP
    What u can imagine it u can PHP it

  2. #2
    pie??? PIE!!!! rsdl's Avatar
    Join Date
    May 2001
    Location
    Vancouver, BC Canada
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can
    a) limit the amount of characters the text field is set to accept
    b) limit the amount of characters the sql table is allowed to accept (if you're using mysql to store information)
    c) by using php you can use the sizeof() function to see the size of the entered stuff and make an IF statement where if sizeof is greater than a certain number then reject it.

  3. #3
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sizeof is an alias of count() which just counts the elments of an array, use strlen().

    (I posted this first, then misinterpreted the PHP manual, then edited to the incorrect info, now I'm editing it back )
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  4. #4
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    correction, sizeof() counts the number of elements in an array, strlen() would be the appropriate function.

    - website

  5. #5
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    fast replies
    - website

  6. #6
    Non-Member Icheb's Avatar
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    1,474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wordwrap -- Wraps a string to a given number of characters using a string break character

    http://www.php.net/manual/en/function.wordwrap.php

  7. #7
    pie??? PIE!!!! rsdl's Avatar
    Join Date
    May 2001
    Location
    Vancouver, BC Canada
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    woops. my mistake :P


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
  •