trying to do something simple

Discussion in 'JavaScript' started by mybluehair, Jan 6, 2008.

  1. #1
    I am trying to make a javascript code were when the user clicks a botton, it adds to the amount $myamount
    here is what I have so far, but it completely dosn't work. (im new to javascript)

     
    mybluehair, Jan 6, 2008 IP
  2. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    var myAmount = 0;

    <INPUT TYPE="button" VALUE="CLICK!"
    onClick="myAmount++">
     
    MMJ, Jan 7, 2008 IP
  3. mybluehair

    mybluehair Peon

    Messages:
    1,374
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I would also like to get the number of times clicked by php. how is that possible?
     
    mybluehair, Jan 7, 2008 IP
  4. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What do you mean?
     
    MMJ, Jan 8, 2008 IP
  5. mybluehair

    mybluehair Peon

    Messages:
    1,374
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #5
    every time the button is hit, it counts up. then when the user wants, at a certain point (lets say after 5 clicks) they can click the "submit" botton. this will take then to a new php page, witch will inject SQL (it will rack up a feild by 5) but to do this, php needs to now how many times the button was clicked.
     
    mybluehair, Jan 8, 2008 IP
  6. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #6
    <?php
    session_start();
    $_SESSION['clicks']++;
    if ($_SESSION['clicks'] >= 5)
    	//do the dew
    
    PHP:
     
    MMJ, Jan 9, 2008 IP