PHP Input OnChange

/*
You can't execute PHP in the browser.
Do an AJAX call or POST to a PHP function on the web server, 
or write a Javascript function that executes in the browser.
*/

// html
<input name="file" onchange="mainInfo(this.value);"
// AJAX
function mainInfo(id) {
    $.ajax({
        type: "GET",
        url: "mypage.php",
        data: "mainid =" + id,
        success: function(result) {
            $("#somewhere").html(result);
        }
    });
};

// php
<?php
    if(isset($_GET['mainid'])){
        mainInfo($_GET['mainid']);
    }
?>
ammer