textbox onchange call php function [duplicate]
This question already has answers here : Closed 5 years ago . Call php function from JavaScript (4 answers) How can i call a php function from onchange on an html form textbox? I have tried <input onchange="phpfunction()" ..... > <?php function phpfunction() { my function } ?> Any Help? I Can't seem to figure it out. Thank You You have to do an ajax call and post that your PHP. Example: HTML: <input name="blah" onchange="mainInfo(this.value);"> Javascript Function (AjaX) function mainInfo(id) { $.ajax({ type: "GET", url: "dummy.php", data: "mainid =" + id, success: function(result) { $("