How to check if the user input is a string?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rocky86
    New Member
    • Jun 2007
    • 93

    How to check if the user input is a string?

    Hi I want to know how do I check if the user input from actionscripts is a string when it is pass to php
  • Purple
    Recognized Expert Contributor
    • May 2007
    • 404

    #2
    Hi,

    Have you looked at is_string() here

    Regards Purple

    Comment

    • kovik
      Recognized Expert Top Contributor
      • Jun 2007
      • 1044

      #3
      A string... as opposed to what? A number?

      You may want to try ctype_alpha().

      Comment

      • Rocky86
        New Member
        • Jun 2007
        • 93

        #4
        Originally posted by volectricity
        A string... as opposed to what? A number?

        You may want to try ctype_alpha().
        sort of checking if the user input is string like eg: letter
        to check if what the user input is a alphapert

        Comment

        • Rocky86
          New Member
          • Jun 2007
          • 93

          #5
          Originally posted by Rocky86
          sort of checking if the user input is string like eg: letter
          to check if what the user input is a alphapert
          Is my code correct to check if the user input from actionscript is a alphapert? and return a error message to actionscript
          [PHP]
          $postalno=subst r($_GET["postal"],0,2);
          if(ctype_alpha( $postalno)){

          $report.="error "."="."Erro r text enter number"."&";
          echo $report;


          [/PHP]

          Comment

          • kovik
            Recognized Expert Top Contributor
            • Jun 2007
            • 1044

            #6
            Originally posted by Rocky86
            [PHP]if(ctype_alpha( $postalno)){

            $report.="error "."="."Erro r text enter number"."&";[/PHP]
            Did you read the documentation for ctype_alpha() at all...?

            Comment

            • prakashl
              New Member
              • Aug 2007
              • 1

              #7
              did u check the is_string()
              function.

              Comment

              Working...