在php中获取javascript部分/变量

I have a function like this :

<script>
    function scanToLocalDisk() {

        scanner.scan(displayResponseOnPage,
            {
                "output_settings": [
                    {
                        "type": "save",
                        "format": "pdf",
                        "save_path": "C:\\xampp\\htdocs\\phps\\scanner\\${TMS}${EXT}"
                    }
                ]
            }
        );
    }

    function displayResponseOnPage(successful, mesg, response) {
        if(!successful) { // On error
            document.getElementById('response').innerHTML = 'Failed: ' + mesg;
            return;
        }

        if(successful && mesg != null && mesg.toLowerCase().indexOf('user cancel') >= 0) { // User cancelled.
            document.getElementById('response').innerHTML = 'User cancelled';
            return;
        }

        document.getElementById('response').innerHTML = scanner.getSaveResponse(response);
    }
</script>

and html like this :

<form class='form-horizontal' role='form' action="../proses/tambahtamu.php" method="POST" >    
    <button type="button" onclick="scanToLocalDisk();">Scan</button>
    <div id="response" ></div>
    <button type="submit">Tambah Tamu</button>
</form>

What I wanna ask is; How do I get the "save_path": "C:\xampp\htdocs\phps\scanner\${TMS}${EXT}" with PHP to use for adding to database?

You can add hidden field in form like this

 <input id="save_path" type="hidden" name="save_path" value="" />

in scanToLocalDisk function add variable

var savePath = "C:\\xampp\\htdocs\\phps\\scanner\\${TMS}${EXT}";

document.getElementById("save_path").value = savePath;

when your form will be post then you will get full path in $_POST["save_path"] variable.