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

📄 contact_edit.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_edit.php?ContactID=".$edit."\">";
			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_edit.php?ContactID=".$edit."\">";
			exit;
		}

		$sql="update $tbl_crm_contact set ContactName='$ContactName',ZhiWu='$ZhiWu',Email='$Email',Dept='$Dept',OfficeTel='$OfficeTel',ChenWei='$ChenWei',Mobile='$Mobile',Source='$Source',HomeTel='$HomeTel',Birthday='$Birthday',OfficeFax='$OfficeFax',Relation='$Relation',Hobby='$Hobby',AccountID='$AccountID' where ContactID='$edit'";
		mysql_query($sql);
		echo "成功编辑联系人,请稍候...";
		echo "<META HTTP-EQUIV=\"Refresh\"  CONTENT=\"3; url=contact_list.php\">";
		exit;
	}
	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='$ContactID'";
	$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);

	$sql_relation="select * from $tbl_crm_account_relationship";
	$res_relation=mysql_query($sql_relation);
?>
		<br>
      <form method="post" action="contact_edit.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" value="<? echo $row[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($row_source=mysql_fetch_array($res_source))
			{
				$option_source = "<option value=".$row_source[SourceID];
				if($row_source[SourceID]==$row[Source])
					$option_source.= " selected";
				$option_source.= ">".$row_source[SourceName]."</option>\n";
				echo $option_source;
			}
?>
			  </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($row_relation=mysql_fetch_array($res_relation))
			{
				$option_relation = "<option value=".$row_relation[RelationshipID];
				if($row_relation[RelationshipID]==$row[Relation])
					$option_relation.= " selected";
				$option_relation.= ">".$row_relation[RelationshipName]."</option>\n";
				echo $option_relation;
			}
?>
				</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];
				
				if ($key == $row[AccountID])
					echo "<option value=\"$key\" selected>$val</option>";
				else
					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[$row[AddID]] ?></td>
            <td width="25%" height="21">创建时间</td>
            <td width="25%" height="21"><? echo $row[CreateTime] ?></td>
          </tr>
        </table>
        <br>
        <table width="95%" border="0" cellspacing="0" cellpadding="5" align="center">
          <tr>
            <td>
			  <input type="hidden" name="edit" value=<? echo $ContactID ?>>
              <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 + -