⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contact_add.php

📁 CRM 不仅仅是一个管理名词和管理概念
💻 PHP
字号:
<?
	########################################
	#OsoonCrm
	#新增联系人
	########################################
		
	include "include/db.inc.php";
	include "include/check.inc.php";
	include "include/array.inc.php";
	
	if($Submit)
	{
		//check submit
		if(!$ContactName)
		{
			echo "请填写联系人姓名...";
			echo "<META HTTP-EQUIV=\"Refresh\"  CONTENT=\"3; url=contact_add.php\">";
			exit;
		}
		if (!(eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$",$Email)))
		{
			echo "联系人电子邮件填写错误,请返回重新填写...";
			echo "<META HTTP-EQUIV=\"Refresh\"  CONTENT=\"3; url=contact_add.php\">";
			exit;
		}
		
		$sql="insert into $tbl_crm_contact (ContactName,ZhiWu,Email,Dept,OfficeTel,ChenWei,Mobile,Source,HomeTel,Birthday,OfficeFax,Relation,Hobby,AccountID,CreateTime,AddID)values('$ContactName','$ZhiWu','$Email','$Dept','$OfficeTel','$ChenWei','$Mobile','$Source','$HomeTel','$Birthday','$OfficeFax','$Relation','$Hobby','$AccountID','$today','$AddID')";
		mysql_query($sql);
		echo "成功创建新联系人,请稍候...";
		echo "<META HTTP-EQUIV=\"Refresh\"  CONTENT=\"3; url=contact_list.php\">";
		exit;
	}
	$today=date("Y-m-d");
	include "include/header.inc.php";
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="90%">
  <tr valign=top> 
    <td width="201">
<?
	include "include/left.inc.php";
?>
    </td>
    <td>
<?
	$sql="select * from $tbl_crm_contact where ContactID='$viewid'";
	$res=mysql_query($sql);
	$row=mysql_fetch_array($res);

	$sql_account="select * from $tbl_crm_account where AccountOwnerID='$G_uid'";
	$res_account=mysql_query($sql_account);

	$sql_source="select * from $tbl_crm_source";
	$res_source=mysql_query($sql_source);
?>
		<br>
      <form method="post" action="contact_add.php">
        <table width="95%" border="0" cellspacing="0" cellpadding="5" align="center">
          <tr> 
            <td width=50%><b>添加联系人</b><font color="red"> * </font>为必填项</td>
            <td width=50% align=right><a href="contact_add.php">添加联系人</a> | <a href="contact_list.php">联系人列表</a></td>
		  </tr>
        </table>
        <hr width=95% align=center>
        <table width="95%" border="1" cellspacing="0" cellpadding="5" align="center" bgcolor="#ede5d2" bordercolor="#FFFFFF">
          <tr> 
            <td colspan="2"> <b>基本信息</b></td>
          </tr>
        </table>
        <table width="95%" border="1" cellspacing="0" cellpadding="5" align="center" bgcolor="#F5F1E9" bordercolor="#FFFFFF">
          <tr> 
            <td width="25%">联系人姓名<font color="red"> * </font></td>
            <td width="25%">
              <input type="text" name="ContactName">
            </td>
            <td width="25%">职务</td>
            <td width="25%">
              <input type="text" name="ZhiWu" value="<? echo $row[ZhiWu] ?>">
            </td>
          </tr>
          <tr> 
            <td width="25%">电子邮件</td>
            <td width="25%">
              <input type="text" name="Email" value="<? echo $row[Email] ?>">
            </td>
            <td width="25%">部门</td>
            <td width="25%">
              <input type="text" name="Dept" value="<? echo $row[Dept] ?>">
            </td>
          </tr>
          <tr> 
            <td width="25%">工作电话</td>
            <td width="25%">
              <input type="text" name="OfficeTel" value="<? echo $row[OfficeTel] ?>">
            </td>
            <td width="25%">称谓</td>
            <td width="25%">
              <input type="text" name="ChenWei" value="<? echo $row[ChenWei] ?>">
            </td>
          </tr>
          <tr> 
            <td width="25%">移动电话</td>
            <td width="25%">
              <input type="text" name="Mobile" value="<? echo $row[Mobile] ?>">
            </td>
            <td width="25%">来源</td>
            <td width="25%"> 
              <select name="Source">
<?
	while (list($key, $val) = each($array_crm_source)) {
		if ($key == $row[Source])
			echo "<option value=\"$key\" selected>$val</option>";
		else
			echo "<option value=\"$key\">$val</option>";
	}
?>
			  </select>
            </td>
          </tr>
          <tr> 
            <td width="25%">家庭电话</td>
            <td width="25%">
              <input type="text" name="HomeTel" value="<? echo $row[HomeTel] ?>">
            </td>
            <td width="25%">生日</td>
            <td width="25%">
              <input type="text" name="Birthday" value="<? echo $row[Birthday] ?>">
            </td>
          </tr>
          <tr> 
            <td width="25%">工作传真</td>
            <td width="25%">
              <input type="text" name="OfficeFax" value="<? echo $row[OfficeFax] ?>">
            </td>
            <td width="25%">与联系人的关系</td>
            <td width="25%"> 
              <select name="Relation">
<?
	while (list($key, $val) = each($array_crm_account_relationship)) {
		if ($key == $row[Relation])
			echo "<option value=\"$key\" selected>$val</option>";
		else
			echo "<option value=\"$key\">$val</option>";
	}
?>
			  </select>
            </td>
          </tr>
          <tr>
            <td width="25%">个人爱好</td>
            <td width="25%">
              <input type="text" name="Hobby" value="<? echo $row[Hobby] ?>">
            </td>
            <td width="25%">&nbsp;</td>
            <td width="25%">&nbsp;</td>
          </tr>
        </table>
        <br>
        <table width="95%" border="1" cellspacing="0" cellpadding="5" align="center" bgcolor="#ede5d2" bordercolor="#FFFFFF">
          <tr> 
            <td colspan="2"> <b>所属客户</b></td>
          </tr>
        </table>
        <table width="95%" border="1" cellspacing="0" cellpadding="5" align="center" bgcolor="#F5F1E9" bordercolor="#FFFFFF">
          <tr> 
            <td width="25%">客户名称</td>
            <td width="75%">
			<select name="AccountID">
<?
	while ($row_account=@mysql_fetch_array($res_account))
	{
		$key = $row_account[AccountID];
		$val = $row_account[AccountName];
		echo "<option value=\"$key\">$val</option>";
	}
?>
			</select>
			</td>
          </tr>
        </table>
        <br>
        <table width="95%" border="1" cellspacing="0" cellpadding="5" align="center" bgcolor="#ede5d2" bordercolor="#FFFFFF">
          <tr> 
            <td colspan="2"> <b>创建者</b></td>
          </tr>
        </table>
        <table width="95%" border="1" cellspacing="0" cellpadding="5" align="center" bgcolor="#F5F1E9" bordercolor="#FFFFFF">
          <tr> 
            <td width="25%" height="21">创建者</td>
            <td width="25%" height="21"><? echo $array_crm_id2user[$G_uid] ?></td>
            <td width="25%" height="21">创建时间</td>
            <td width="25%" height="21"><? echo $today ?></td>
          </tr>
        </table>
        <br>
        <table width="95%" border="0" cellspacing="0" cellpadding="5" align="center">
          <tr>
            <td>
			  <input type="hidden" name="AddID" value="<? echo $G_uid?>">
			  <input type="hidden" name="today" value="<? echo $today ?>">
              <input type="submit" name="Submit" value="添加联系人">
              <input type="button" name="button" value="取消并返回" onclick="javascript:history.back();">
            </td>
          </tr>
        </table>
      </form>
      <p>&nbsp;</p></td>
  </tr> 
</table>
<?
	include "include/footer.inc.php";
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -