客户端的html
<form action="hb_ggzd_usemsg.php" method="post" align="center">
<tr>
<td width="251"><small>您 可 以 花 些 时 间 填 写 下 表 , 也 可 以 用 电
子 邮 件 联 系 ,<a href="mailto:[email protected]"></a>。</small></td>
</tr>
<tr>
<td vAlign="top" width="251" height="31"><small>您的姓名:</small></td>
<td width="462" height="31"><small><input name="name" size="255"> </small></td>
</tr>
<tr>
<td vAlign="top" width="251" height="30"><small>您的电子邮件:</small></td>
<td width="462" height="30"><small><input name="usermail" size="255"></small></td>
</tr>
<tr>
<td vAlign="top" width="251" height="25"><small>您欲做广告的网站地址:</small></td>
<td width="462" height="25"><small><small><input name="userurl" size="255" value="http://"></small></small></td>
</tr>
<tr>
<td vAlign="top" width="251" height="25"><small>您欲做广告的网站站名:</small></td>
<td width="462" height="25"><small><input name="sitename" size="255"></small></td>
</tr>
<tr>
<td vAlign="top" width="251" height="30"><small>您的公司名称:</small></td>
<td width="462" height="30"><small><input name="company" size="255"></small></td>
</tr>
<tr>
<td vAlign="top" width="251" height="25"><small>您的联系电话:</small></td>
<td width="462" height="25"><small><input name="phone" size="255"></small></td>
</tr>
<tr>
<td vAlign="top" width="251" height="40"><small>您的广告意向:</small></td>
<td width="462" height="40"><small>
<input name="C1" type="checkbox"value="索要广告详细报价">索要广告详细报价
<input name="C2" type="checkbox" value="索要广告详情">索要广告详情
<input name="C3" type="checkbox" value="索要协议样本">索要协议样本
<input name="C4" type="checkbox" value="需要电话联系">需要电话联系
<input name="C5" type="checkbox" value="索要银行帐号">索要银行帐号</small></td>
</tr>
服务器端的php
<?php
echo "您的姓名:";
echo $name ;
echo "t";
echo "您的电子邮件:";
echo $usermail ;
echo "t";
echo "您欲做广告的网站地址:";
echo $userurl ;
echo "t";
echo "您欲做广告的网站站名:";
echo $sitename ;
echo "t";
echo "您的公司名称:";
echo $company ;
echo "t";
echo "您的联系电话:";
echo $phone ;
echo "t";
echo "您的广告意向:";
echo $C1;
echo "t";
echo $C2;
echo "t";
echo $c3;
echo "t";
echo $C4;
echo "t";
echo $C5;
echo "t";
/////////////
if ($C1){
$C1="1";}
else
{$C1="0";
}
if ($C2){
$C2="1";}
else
{$C2="0";
}
if ($C3){
$C3="1";}
else
{$C3="0";
}
if ($C4){
$C4="1";}
else
{$C4="0";
}
if ($C5){
$C5="1";}
else
{$C5="0";
}
$dbh = mysql_connect(’localhost:3306’,’root’,’’);
mysql_select_db(’HBWEB’);
$query ="insert into usemsg ( name,usermail,userurl,sitename, company,phone,c1,c2,c3,c4,c5) values (’$name’,’$usermail’,’$userurl’, ’$sitename’, ’$company’,’$phone’,’$C1’,’$C2’,’$C3’,’$C4’,’$C5’)";
$res = mysql_query($query, $dbh);
$err = mysql_error();
if($err){
echo "发生错误,请通知<a href=mailto:[email protected]>站长</a>";
echo "$err";
}
else
{ echo "成功入库"; }
?>
表结构:
CREATE TABLE usemsg (
name varchar(255) not null default "notname",
usermail varchar(255) not null default "notusermail",
userurl varchar(255) not null default "notuserurl",
sitename varchar(255) not null default "notsitename",
company varchar(255) not null default "notcompany",
phone varchar(255) not null default "notphone",
c1 char(1) not null default "0",
c2 char(1) not null default "0",
c3 char(1) not null default "0",
c4 char(1) not null default "0",
c5 char(1) not null default "0"
);
|