i have my code like this :
<?php
include 'fonctions.php';
?>
<input type="button" onClick="chauffeur_info(330);" />
<h1 id="header"></h1>
<script>
function chauffeur_info(matricule){
console.log(matricule);
var result = "<?php echo get_nom_prenom_chauffeur(matricule); ?>";
document.getElementById("header").innerHTML = result;
}
</script>
when i call it like that it gives me an error, but when i do :
var result = "<?php echo get_nom_prenom_chauffeur(330); ?>";
document.getElementById("header").innerHTML = result;
it's working perfectly, any idea why it's not working.
PS: console.log is giving me the right value
Thanks in advance