1/*
2You can't execute PHP in the browser.
3Do an AJAX call or POST to a PHP function on the web server,
4or write a Javascript function that executes in the browser.
5*/
6
7// html
8<input name="file" onchange="mainInfo(this.value);"
9// AJAX
10function mainInfo(id) {
11 $.ajax({
12 type: "GET",
13 url: "mypage.php",
14 data: "mainid =" + id,
15 success: function(result) {
16 $("#somewhere").html(result);
17 }
18 });
19};
20
21// php
22<?php
23 if(isset($_GET['mainid'])){
24 mainInfo($_GET['mainid']);
25 }
26?>
27