//header("content-type:text/html; charset=utf-8"); include("conn.php"); //数据链接 include("common.php"); //引入友好提示自编函数 //写入数据库--------------------------------------- if($_POST[ok]){ if($_POST[requiretype]==''){ErrView("·请输入输入需求类型!",0);exit;} if($_POST[username]==''){ErrView("·请输入姓名!",0);exit;} //if($_POST[mobile]==''){ErrView("·请输入手机!",0);exit;} if ( empty($_POST[mobile]) || !preg_match("/^\d{8,}$/",$_POST[mobile]) //验证至少8位数字 // || !ereg("^[0-9a-zA-Z\_]*$",$_POST[tel]) //验证是否为数字 ) { ErrView("·输入的手机格式不正确,请重新输入!",0);exit; } //if($_POST[tel]==''){ErrView("·请输入电话!",0);exit;} if ( empty($_POST[tel]) || !preg_match("/^\d{8,}$/",$_POST[tel]) //验证至少8位数字 // || !ereg("^[0-9a-zA-Z\_]*$",$_POST[tel]) //验证是否为数字 ) { ErrView("·输入的电话格式不正确,请重新输入!",0);exit; } //if($_POST[email]==''){ErrView("·请输入电子邮箱!",0);exit;} if ( empty($_POST[email]) || !ereg("^[-a-zA-Z0-9_.]+@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{2,5}$",$_POST[email]) ) { ErrView("·您输入的邮箱格式不正确,请重新输入!",0);exit; //echo "邮箱格式不正确";exit; } if($_POST[company]==''){ErrView("·请输入公司名称!",0);exit;} if($_POST[city]==''){ErrView("·请选择所在的城市!",0);exit;} if($_POST[usertype]==''){ErrView("·请输入用户类型!",0);exit;} if($_POST[feedback]==''){ErrView("·请输入反馈内容!",0);exit;} $sql = "insert into signup (requiretype,username,mobile,tel,email,company,city,usertype,feedback,intime) values ('$_POST[requiretype]','$_POST[username]','$_POST[mobile]','$_POST[tel]','$_POST[email]','$_POST[company]','$_POST[city]','$_POST[usertype]','$_POST[feedback]',now())"; mysql_query($sql); mysql_close(); 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(); ?>