0

friends.

I am trying to send a value to a js function and print it using php code, so I've tried this code:

<script>
getName("Jack");
function getName(name){
var n = "You have choosed: " + name";
<?php echo " . n. "; ?> //it supposed to print You have choosed: Jack
}
</script>

but the code above didn't work! can you help me please?

  • 1
    Read the following **very carefully** and if you still have questions on what you need to do then do update your question. https://softwareengineering.stackexchange.com/questions/171203/what-are-the-differences-between-server-side-and-client-side-programming – apokryfos Apr 15 '20 at 23:17
  • php is server side, Javascript is client side, you need to make a request to server to do that. You can use document.write(name) . – flakerimi Apr 16 '20 at 00:43

0 Answers0