stop();
System.useCodepage=true;
var zishu = new LoadVars();
mt.add_button.onRelease = function() {
zishu.action = "zishu";
zishu.add_city = mt.add_city.value;
zishu.add_name = mt.add_name.text;
zishu.add_time = mt.add_time.text;
zishu.add_sex = mt.add_sex.selection.data;
zishu.lovea = mt.lovea.label;
zishu.loveb = mt.loveb.label;
zishu.lovec = mt.lovec.label;
zishu.loved = mt.loved.label;
zishu.lovee = mt.lovee.label;
zishu.lovef = mt.lovef.label;
zishu.add_email = mt.add_email.text;
zishu.add_ress = mt.add_ress.text;
zishu.add_url = mt.add_url.text;
zishu.add_word = mt.add_word.text;
zishu.sendAndLoad("add.php",zishu,"POST");
gotoAndplay(2);
}
以下是PHP代码:
程序代码
mysql_connect("localhost","root","admin");
mysql_select_db("zishubook");
$add_city = $_POST['add_city'];
$add_name = $_POST['add_name'];
$add_time = $_POST['add_time'];
$add_sex = $_POST['add_sex'];
$lovea = $_POST['lovea'];
$loveb = $_POST['loveb'];
$lovec = $_POST['lovec'];
$loved = $_POST['loved'];
$lovee = $_POST['lovee'];
$lovef = $_POST['lovef'];
$add_email = $_POST['add_email'];
$add_ress = $_POST['add_ress'];
$add_url = $_POST['add_url'];
$add_word = $_POST['add_word'];
$love = $lovea.$loveb.$lovec.$loved.$lovee.$lovef;
if($_POST["action"]=="zishu") {
mysql_query("insert into contacts values('','".$add_city."','".$add_name."','".$add_time."','".$add_sex."','".$love."','".$add_email."','".$add_ress."','".$add_url."','".$add_word."')");
}
?>
表单的效果图如下: