A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: easy question for more experienced - RE: forms

  1. #1
    Senior Member
    Join Date
    Feb 2001
    Posts
    235

    easy question for more experienced - RE: forms

    Having some trouble with this.
    Should be a cinch for a more experienced scripter.

    I need to set up a form that will have one of the fields checked.
    It needs to validate the number of characters entered in ordered to proceed.

    e.g. must enter 18 characters.
    Haven't been able to figure out a way and prefer not to use js.

    Any help appreciated. Thanks in advance!

  2. #2
    always learning
    Join Date
    Sep 2004
    Location
    somewhere over the rainbow
    Posts
    90
    Hello fla999,

    If you are using PHP you can use a function that checks the string length:

    if (strlen($your_variable)<18) {

    //DO THIS IF TRUE

    } esle {

    //DO THIS IF FALSE

    }

    You can go to:www.php.net to learn more about PHP.

    Hope I helped a bit,

    Loo
    Loo fe le vi

  3. #3
    always learning
    Join Date
    Sep 2004
    Location
    somewhere over the rainbow
    Posts
    90
    There is a type-o

    Here is the correct code with the correction in bold:

    if (strlen($your_variable)<18) {

    //DO THIS IF TRUE

    } else {

    //DO THIS IF FALSE

    }
    Loo fe le vi

  4. #4
    Senior Member
    Join Date
    Feb 2001
    Posts
    235
    Hey Loo

    Appreciate the help.

    I'm not up to speed on this, but can you explain

    //DO THIS IF TRUE

    } else {

    //DO THIS IF FALSE

    }

    It says 'do this if true' > but what is it to do?
    followed by
    } else {

    -------
    excuse my ignorance.
    When I look at this, I see it trying verify the string length.

    I don't get what it is supposed to do whether it is true or false.

  5. #5
    always learning
    Join Date
    Sep 2004
    Location
    somewhere over the rainbow
    Posts
    90
    Sup fla999,

    OK here it goes :

    if (strlen($your_variable)<18) {

    print"You have NOT entered 18 characters";

    } else {

    print"You HAVE entered 18 or more characters";

    }

    Meaning that if what you have typed is less than 18, print to browser "You have NOT entered 18 characters", but if its not less than 18(or else ) print "You HAVE entered 18 or more characters".

    PHP is an open source language meaning its FREE .

    You should look up a tutorial about PHP, its pretty easy to understand.
    Trust me, you'll see.

    Good luck,

    Loo
    Loo fe le vi

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center