Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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']);
    }
?>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #input #onchange
ADD COMMENT
Topic
Name
4+5 =