Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
parse javascript variable as a PHP argument

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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!