📄 modprdct.php
字号:
<?
require('session.inc');
require('connect.inc');
if ($usern!=-1)
{
html_header("非法登录,拒绝访问 - ACCESS DENIED",'<META http-equiv="refresh" content="3; url=index.php">');
echo "<td align=right valign=center><br>
Sorry, 您正想非法登录本系统,请正常登录!<br>系统会在3秒后自动返回登录页面。
<br><br><br><a href=index.php>返回登录</a></td>";
html_footer();
}
else
{
?>
<html>
<head>
<title>::: DATABASE 化妆品公司数据库管理系统 - 修改产品信息 :::</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="common.css" type="text/css">
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') {
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="770" border="0" cellspacing="0" cellpadding="0" align="center" height="450">
<tr>
<td background="images/bg2.jpg">
<table width="770" border="0" cellspacing="0" cellpadding="0" height="450">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="450">
<tr>
<td height="140" class="bigh"><font color=#ff3333>修改产品信息</font></td>
</tr>
<tr>
<td valign=top>
<?
if ($step==0)
{
$str_sql="select pid,pname from PRODUCTTB;";
$result=mysql_db_query($db,$str_sql,$link_id);
if (!$result) html_error_exit('MySQL查询命令失败!');
else
{
?>
<table width="45%" border="0" cellspacing="0" cellpadding="0" align="right">
<tr>
<td>
<form name="form1" method="post" action="modprdct.php?step=1">
<p><b><font face=Arial>Step 1 </font>- 选择要修改的产品</b></p>
<p>
<select name="pid">
<?
$html='';
while ($record=mysql_fetch_object($result))
$html.='<option value="'.$record->pid.'">'.$record->pid." - ".$record->pname.'</option>';
echo $html;
?>
</select>
</p>
<p>
<input type="submit" name="Submit" value="修 改">
<a href=index2.php>返回首页</a> </p>
</form>
</td>
</tr>
</table>
<?
}
}
else
{
if ($step==1)
{
$str_sql="select * from PRODUCTTB where pid = '$pid';";
$result=mysql_db_query($db,$str_sql,$link_id);
if (!$result) html_error_exit('MySQL查询命令失败!');
else
{
$record=mysql_fetch_object($result);
echo' <table width="45%" border="0" cellspacing="0" cellpadding="0" align="right">
<tr>
<td>
<form name="form1" method="post" action="modprdct.php?step=2">
<p><b><font face=Arial>Step 2 </font>- 请修改产品纪录</b></p>
<table width="100%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td width="33%">产品号 '.$pid.'
<input type="hidden" name="pid" value="'.$pid.'">
</td>
<td width="33%">商 标
<input type="text" name="mark" size="8" maxlength="20" value="'.$record->mark.'">
</td>
<td>货品类别
<input type="text" name="class" size="8" maxlength="10" value="'.$record->class.'">
</td>
</tr>
<tr>
<td width="33%">产品名
<input type="text" name="pname" size="8" maxlength="20" value="'.$record->pname.'">
</td>
<td width="33%">批发价
<input type="text" name="pprice" size="8" maxlength="11" value="'.$record->pprice.'">
</td>
<td>零 售 价
<input type="text" name="sprice" size="8" maxlength="11" value="'.$record->sprice.'">
</td>
</tr>
<tr>
<td width="33%">单 位
<input type="text" name="unit" size="4" maxlength="4" value="'.$record->unit.'">
</td>
<td width="33%">颜 色
<input type="text" name="color" size="8" maxlength="10" value="'.$record->color.'">
</td>
<td>有 效 期
<input type="text" name="life" size="4" maxlength="4" value="'.$record->life.'">
月</td>
</tr>
<tr>
<td colspan="3">备注<br>
<div align=center>
<textarea name="memo" cols="56" rows="5">'.$record->memo.'</textarea>
</div>
</td>
</tr>
</table>';
?> <p>
<input type="submit" name="Submit" value="修改信息" onClick="MM_validateForm('pid','','RisNum','mark','','R','class','','R','pname','','R','pprice','','RisNum','sprice','','RisNum','unit','','R','color','','R','life','','RisNum');return document.MM_returnValue">
<input type="reset" name="reset" value="重置表单"> <a href=index2.php>返回首页</a></p>
</form>
</td>
</tr>
</table>
<? }
}
else
{
$str_sql="update PRODUCTTB set
mark = '$mark',
class = '$class',
pname = '$pname',
pprice = '$pprice',
sprice = '$sprice',
color = '$color',
life = '$life',
unit = '$unit',
memo = '$memo'
where pid= '$pid';";
$result=mysql_db_query($db,$str_sql,$link_id);
if (!$result) html_error_exit('MySQL查询命令失败!');
else
{
echo "<div align=right><br>产品信息修改成功,信息如下:<br><table border=0 width=40%><tr><td>
<li>产 品 ID - $pid
<li>产品商标 - $mark
<li>产品类别 - $class
<li>产 品 名 - $pname
<li>批 发 价 - $pprice
<li>零 售 价 - $sprice
<li>单 位 - $unit
<li>颜 色 - $color
<li>有 效 期 - $life 月
<li>备 注 - <br> $memo
</td></tr></table>
<br><br><br><a href=modprdct.php?step=0>返回继续修改</a> <a href=index2.php>返回首页</a></div>";
}
}
}
@mysql_close($link_id);
?>
</td>
</tr>
<tr>
<td height="40">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="40">
<tr>
<td valign="bottom" align="right"><font face="Arial"><b>Powered
by <img src="images/php.gif" width="39" height="20" align="absmiddle">
& <img src="images/mysql.gif" width="82" height="20" align="absmiddle"></b></font></td>
<td align="right" valign="bottom" width="200"><font face="Arial">©
<a href="mailto:lonelyp@etang.com">Lonely Passenger</a>,2001<br>
All rights reserved!</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -