You need to add an interface, at the time the webView declares.
Example:
WebView webView = (WebView) findViewById(R.id.webview);
webView.addJavascriptInterface(new WebAppInterface(this), "Android");
WebAppInterface class code:
public class WebAppInterface {
Context mContext;
/** Instantiate the interface and set the context */
WebAppInterface(Context c) {
mContext = c;
}
/** Show a toast from the web page */
@JavascriptInterface
public void showToast(String toast) {
Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
}
}
Now in your PHP, you should include the onClick in your input.
Example:
<input type="button" value="Say hello" onClick="showAndroidToast('Hello Android!')" />
And the JavaScript that will be responsible for "chatting" with Android:
Example:
<script type="text/javascript">
function showAndroidToast(toast) {
Android.showToast(toast);
}
</script>
You can see more examples and details on the Android documentation