單擊它時會有一個按鈕將語句插入到數據庫,但即使沒有單擊該按鈕,insert語句已經運行.why?單擊按鈕時插入數據庫
<?php
header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
include_once 'mysqli.connect.php';
include_once 'fbmain.php';
if($me){
$fbid= $facebook->api('/me');
$fbme = $fbid['id'];
$fbName = $fbid['name'] ;
$fbEmail = $fbid['email'];
}
if (isset($_POST)){
mysqli_query($mysqli, "INSERT INTO members (fbId, name, email) values ('$fbme', '$fbName', '$fbEmail')") or die(mysql_error());
}
?>
<html>
<form action="" method="post">
<input type="image" src="../images/buy.png" name="submit" width="60"height="30" />
</form>
</html>
這比表單提交更適合於ajax。 – mowwwalker 2012-02-02 06:27:33