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

No you can't. 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 datas. Then in your php file you can ask those datas down.

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