header("content-type:text/html; charset=utf-8"); include("conn.php"); //数据链接 include("common.php"); //引入友好提示自编函数 //写入数据库--------------------------------------- if($_POST[ok]){ if($_POST[city]==''){ErrView("·请选择报名的城市!",0);exit;} if($_POST[username]==''){ErrView("·请输入姓名!",0);exit;} if($_POST[tel]==''){ErrView("·请输入电话!",0);exit;} if($_POST[company]==''){ErrView("·请输入公司名称!",0);exit;} if($_POST[email]==''){ErrView("·请输入E-Mail!",0);exit;} if($_POST[mobile]==''){ErrView("·请输入手机!",0);exit;} $sql = "insert into trainning (username,tel,company,mobile,fax,email,city,remark,intime) values ('$_POST[username]','$_POST[tel]','$_POST[company]','$_POST[mobile]','$_POST[fax]','$_POST[email]','$_POST[city]','$_POST[remarks]',now())"; //echo ($sql); mysql_query($sql); mysql_close(); ErrView("·报名成功,我们会尽快与您联系!",1); //ErrView("·报名成功,我们会尽快与您联系!",1); }else{ //读取城市-------------------------------------- $sql = "select * from city order by id asc"; $result = mysql_query($sql); while($rs = mysql_fetch_object($result)) { $cityid .= "\n"; } mysql_close(); ?>