I am trying to implement a little code in HTML; calling a PHP onclick in HTML using the solution here and it just runs to a blank page. Upon inspection, I noticed a typo in my code but after i corrected it the output is still the same i.e. it opens a blank page with no echo or anything.
My question: Is there a way to debug my code so my browser (i suspect) can notify me as to what part or line of my code the error is coming from, like in Java IDEs?
<?php
function working(){
echo 'WORKED ';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dice Game</title>
</head>
<body>
<div>
<div>
<h1 id="player1" onclick="document.write('<?php working(); ?>')">
ENTER PLAYER 1 NAME
</h1>
</div>
</div>
</body>
</html>
Note: I use Chrome
' as a comment. Any idea how i can fix that?
– kbluue Jul 09 '17 at 02:41