I have a problem with php. I was trying to make a button that changes its text into random numbers every time I click, but it only worked for once.
My Code:
<!DOCTYPE html>
<html>
<body>
<?php
function yeet(){
return rand(1, 100);
}
?>
<script type="text/javascript">
function yeeb(){
let randNum = <?php echo yeet();?>;
document.getElementById("co").innerHTML = randNum.toString();
}
</script>
<button onclick = "yeeb()" id="co">click</button>
</body>
</html>
Any help would be grateful.