Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2009
    Posts
    215
    Thanks
    74
    Thanked 0 Times in 0 Posts

    Check Name , Comment length

    Hello

    I use this code to make sure the Name and Comment are not embty , but How to make it also check if the Name less than 10 letters and if comment less than 10 letters too.

    I replaced
    PHP Code:
     if ( empty($_POST["name"])) { 
    with
    PHP Code:
     if ( strlen($_POST["name"]) < 10 ){ 
    it worked but not when the comment has smillie code like (My Form includes SMillies ) they pass thru and comment will be accepted , Dont know why , i tried use (strlen) and (mb_strlen) but same problem
    PHP Code:
    // Check if name exist
       
    if ( empty($_POST["name"])) {
     
    redirect_header(site_URL "/index.php" 3_MD_MSGNAMEINS);
      } else if (
    mb_strlen($_POST["name"]) > $b) {
       
    redirect_header(site_URL "/index.php" 3_MD_MSGENAMEINS_LONG);
       }
    // Check if comment exist
       
    if ( empty($_POST["comment"])) {
       
    redirect_header(site_URL "/index.php" 3_MD_MSGEINS);
       } else if (
    mb_strlen($_POST["comment"]) > $a) {
       
    redirect_header(site_URL "/index.php" 3_MD_MSGECOMMENTINS_LONG);
       } 
    Last edited by ajloun; 09-02-2009 at 12:50 AM.

  • #2
    Regular Coder sea4me's Avatar
    Join Date
    Jan 2009
    Location
    Damn, I don't know...
    Posts
    390
    Thanks
    11
    Thanked 28 Times in 27 Posts
    How are the smilies passed??

    with symbols or html code? maybe the html code made it longer than 10 chars...

  • #3
    Regular Coder
    Join Date
    Aug 2009
    Posts
    215
    Thanks
    74
    Thanked 0 Times in 0 Posts
    Simple just code 's the same way you add smile when u make post in this forum.


  •  

    Posting Permissions

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