Is this how you would pass a var from JS to PHP? or is there a better solution. Please could you help with the easiest and most efficient way.
<!DOCTYPE html>
<html>
<body>
<script>
var name="John Doe";
document.write(name + "<br>");
</script>
<?php
$name = <script>document.write(name);</script>
?>
</body>
</html>
I know this won't work, but how would I do it?