Can I put PHP code somewhere in the back-end?

No you can't. It won't work at all.

If you would need to use PHP for any reason, you should just create a PHP file, redirect there, and make your file to redirect back, or if you know more advanced programming, you can do this with AJAX too, for example with the get method you can send through your data. Then in your php file you can ask those data down.

JS:
jQuery.get( "http://example.com/test.php" , { name: "John", time: "2pm" });
PHP:
$name = $_GET['name']; 
$time = $_GET['time'];