0

I'm doing the scoreboard website, so the CSS and HTML is already finished but I stuck with how to count up the score one by one. I use php to change the class name in div and the number will be change. Now I need to change value in the variables in php to change the number. I want to know how to write command to count up the value in php by onclick function, one by one. Thanks for your help.

This is script and php.

function myFunction(){
<?php
    $s = 1;
    $d = "display-no-$s";
?>  }

and this is HTML

<button onclick="myFunction()">Click Me</button>   
    <div id="clock-container">
        <div id="display-1" class="display-container display-size-12 <?php echo $d; ?>">
            <div class="segment-x segment-a"><span class="segment-border"></span></div>
            <div class="segment-y segment-b"><span class="segment-border"></span></div>
            <div class="segment-y segment-c"><span class="segment-border"></span></div>
            <div class="segment-x segment-d"><span class="segment-border"></span></div>
            <div class="segment-y segment-e"><span class="segment-border"></span></div>
            <div class="segment-y segment-f"><span class="segment-border"></span></div>
            <div class="segment-x segment-g"><span class="segment-border"></span></div>
        </div>
    </div>
B001ᛦ
  • 2,036
  • 6
  • 23
  • 31
  • 2
    Because html/css/js runs in the browser (client side) you will need to create an http request (forms, ajax, etc) to let php (server side) know about the changes to make. There a plenty of ways to do this so your question is a bit broad for a good answer. Try to learn about the differences of server and client side coding. – Mark Baijens Nov 09 '18 at 14:38
  • Possible duplicate of [What is the difference between client-side and server-side programming?](https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming) – B001ᛦ Nov 09 '18 at 14:59
  • This link may help https://stackoverflow.com/questions/20738329/how-to-call-a-php-function-on-the-click-of-a-button – Enter Strandman Nov 09 '18 at 15:09
  • you cant combine client and server side script – johnny04501 Nov 09 '18 at 15:32

0 Answers0