php prompt if variable is 0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rubyhuang
    New Member
    • Dec 2007
    • 19

    php prompt if variable is 0

    how to use php to prompt if one variable is 0(the variable is initialised by 10 and decreased 1 by 1). worry to wait for answer,thank you.
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    You'd have to use javascript but you can use PHP to check the value of said variable and then echo out the relevant javascript.

    i,e:
    Code:
    [php]
    $variable = 0; 
    if($variable == 0){
        echo "<script type=\"text/javascript\">";
        echo "alert(\"The variable is 0\")";
        echo "</script>";
    }
    [/php]
    Last edited by zmbd; Nov 26 '12, 03:00 AM. Reason: Placed [CODE][/CODE] tags in zombie thread

    Comment

    • rubyhuang
      New Member
      • Dec 2007
      • 19

      #3
      fantastic, it works. thank you for your help.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by rubyhuang
        fantastic, it works. thank you for your help.
        Welcome!
        Post back when the need takes you.

        Comment

        Working...