一:代码设计

1.index.php

该页面用于显示管理员的登录和物品的库存。并可以进行订货。

<!--html登录界面-->
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<form action="login.php" method="post"><fieldset><legend>用户登录</legend><ul><li><label>账 户:</label><input type="text" name="username"></li><li><label>密 码:</label><input type="password" name="password"><li><label> </label><input type="submit" name="login" value="登录"></li></ul></fieldset></form>
<!-- php清单显示 -->
<?php
$link = mysqli_connect( 'localhost' , 'root', '' , 'test' );
if (!$link)
{  printf("Can't connect to MySQL Server. Errorcode: %s ", mysqli_connect_error()); exit;
}
else
{ echo'数据库连接成功';}mysqli_query($link,'set names utf8');    //解决中文乱码的问题
echo '
<fieldset>
<legend>数据清单</legend>';
if ($result = mysqli_query($link, 'SELECT *  FROM woods ')) {while( $row = mysqli_fetch_assoc($result) ){   ?><ul>
<li>
<form action="request.php" method="post">
<input name="name" readonly="readonly"  value="<?php echo "{$row['name']}"; ?>"><?php echo '  :  ';?>
<input name="num" readonly="readonly" value="<?php echo "{$row['num']}"; ?>">
<input type="submit" name="request" value="请求">
</form>
</li>
</ul><?php}
}
?>

2.login.php

用于对管理员的登录进行验证

<?php header('Content-type:text/html; charset=utf-8');if (isset($_POST['login'])) {# 接收用户的登录信息$username = trim($_POST['username']);$password = trim($_POST['password']);if (($username == '') || ($password == '')) {// 若为空,视为未填写,提示错误,并3秒后返回登录界面header('refresh:3; url=login.html');echo "用户名或密码不能为空,系统将在3秒后跳转到登录界面,请重新填写登录信息!";exit;} $link = mysqli_connect( 'localhost' , 'root', '' , 'test' );   if (!$link) {  printf("Can't connect to MySQL Server. Errorcode: %s ", mysqli_connect_error()); exit; }else{ }mysqli_query($link,'set names utf8'); if ($result = mysqli_query($link, 'SELECT * FROM user ')) {while( $row = mysqli_fetch_assoc($result) ){if( ($username == $row['user'] )  || ($password == $row['passwd'] ) ){header('refresh:0;url=main.php');exit();}else{echo "用户名或密码错误,系统将在3秒后跳转到登录界面,请重新填写登录信息!";header('refresh:3; url=index.php');exit();}}   mysqli_free_result($result); }
else{echo "用户名或密码错误,系统将在3秒后跳转到登录界面,请重新填写登录信息!";header('refresh:3; url=index.php');exit();}     mysqli_close($link);}?>

3.repuest.php

用于订货表单的显示

<?php header('Content-type:text/html; charset=utf-8');
//接受用户的选择
if (isset($_POST['request'])) {
$name = trim($_POST['name']);
?>
<!-- 用户请求表-->
<form action="request2.php" method="post">
<fieldset>
<legend>请求清单</legend>
<ul>
<li>
<lable>角色名</lable>
<?php echo '  :  ';?>
<input name="peoplename"   value="">
</li>
<li>
<lable>物品名</lable>
<?php echo '  :  ';?>
<input type="text" name="name" readonly="readonly"  value="<?php  echo $name;?>">
</li>
<li>
<lable>数  &nbsp  目</lable>
<?php echo '  :  ';?>
<input type="text" name="num"  value="">
</li>
<li>
<input type="submit" name="request" value="请求">
</li>
</ul>
</fieldset><?php
}
?>

4.request2.php

用于让订货信息输入数据库

<?php header('Content-type:text/html; charset=utf-8');if (isset($_POST['request'])) {# 接收用户的请求信息$name = trim($_POST['name']);$peoplename = trim($_POST['peoplename']);$num = trim($_POST['num']);if(($name=="") || ($peoplename=="") || ($num=="") ){header('refresh:3; url=index.php');echo "人物与数目不能为空,系统将在3秒后跳转到首页!";exit;}if($num<=0){header('refresh:3; url=index.php');echo "数据输入不合法,系统将在3秒后跳转到首页!";exit;}$link = mysqli_connect( 'localhost' , 'root', '' , 'test' );   if (!$link) {  printf("Can't connect to MySQL Server. Errorcode: %s ", mysqli_connect_error()); exit; }else{ }mysqli_query($link,'set names utf8'); $peopledid=1;$rest="insert into needs values('','$peoplename','$name',$num,now(),$peopledid)";$result= mysqli_query($link,$rest);if ($result) {echo"请求成功,系统将在3秒后跳转到首页";header('refresh:3; url=index.php');}

5.mian.php

显示出货信息和库存信息

<!--请求清单显示-->
<?php
header('Content-type:text/html; charset=utf-8');$link = mysqli_connect( 'localhost' , 'root', '' , 'test' );
if (!$link) {  printf("Can't connect to MySQL Server. Errorcode: %s ", mysqli_connect_error()); exit;
}
else{ //echo'数据库连接成功';
}mysqli_query($link,'set names utf8');    //解决中文乱码的问题
echo '
<fieldset>
<legend>申请清单</legend>
<table>
<tr>
<td>编号</td>
<td>申请人</td>
<td>物品</td>
<td>数目</td>
<td>申请时间</td>
<td>是否完成</td>
</tr>
';if ($result = mysqli_query($link, 'SELECT *  FROM  needs ')) {while( $row = mysqli_fetch_assoc($result) ){   ?>
<tr>
<form action="chuhuo.php" method="post">
<td><input type="text" size="10" readonly="readonly" name="id" value="<?php echo $row['id'];?>"></td>
<td><input type="text" size="10" readonly="readonly" name="peoplename" value="<?php echo $row['peoplename'];?>"></td>
<td><input type="text" size="10" readonly="readonly" name="name" value="<?php echo $row['name'];?>"></td>
<td><input type="text" size="10" readonly="readonly" name="num" value="<?php echo $row['num'];?>"></td>
<td><input type="text" size="15" readonly="readonly" name="peopledate" value="<?php echo $row['peopledate'];?>"></td>
<td><input type="text" size="10" readonly="readonly" name="peopledid" value="<?php echo $row['peopledid'];?>"></td>
<td><input type="submit" name="queding" value="确定"></td>
<td><input type="button" onclick='location.href=("index.php")' name="" value="首页"></td>
</form>
</tr><?php}mysqli_free_result($result); echo '</table></fieldset>';
}
mysqli_close($link);
?><!--补货显示-->
<?php$link = mysqli_connect( 'localhost' , 'root', '' , 'test' );
if (!$link) {  printf("Can't connect to MySQL Server. Errorcode: %s ", mysqli_connect_error()); exit;
}
else{ //echo'数据库连接成功';
}mysqli_query($link,'set names utf8');    //解决中文乱码的问题
echo '
<fieldset>
<legend>库存清单</legend>
<table>
<tr>
<td>编号</td>
<td>物品</td>
<td>数目</td>
</tr>
';if ($result = mysqli_query($link, 'SELECT *  FROM  woods ')) {while( $row = mysqli_fetch_assoc($result) ){   ?>
<tr>
<form action="buhuo.php" method="post">
<td><input type="text" size="10" readonly="readonly" name="id" value="<?php echo $row['id'];?>"></td>
<td><input type="text" size="10" readonly="readonly" name="name" value="<?php echo $row['name'];?>"></td>
<td><input type="text" size="10" readonly="readonly" name="num" value="<?php echo $row['num'];?>"></td>
<td><input type="submit"  name="buhuo" value="补货"></td>
<td><input type="button" onclick='location.href=("index.php")' name="" value="首页"></td>
</form>
</tr><?php}mysqli_free_result($result); echo '</table></fieldset>';
}
mysqli_close($link);
?>

6.chuhuo.php

用于出货的操作,当货物不足时,无法出货,已出货的物品后面出货信息显示为0,没有出货则为1

<!--请求清单操作模块--><?php
header('Content-type:text/html; charset=utf-8');
if (isset($_POST['queding'])) {$peoplename = trim($_POST['peoplename']);$name = trim($_POST['name']);$num = trim($_POST['num']);$peopledid = trim($_POST['peopledid']);$id = trim($_POST['id']);$link = mysqli_connect( 'localhost' , 'root', '' , 'test' );   if (!$link) {  printf("Can't connect to MySQL Server. Errorcode: %s ", mysqli_connect_error()); exit; }else{ //echo'数据库连接成功';}mysqli_query($link,'set names utf8');    //解决中文乱码的问题$result = mysqli_query($link, "SELECT * FROM woods WHERE id='$id'");$row = mysqli_fetch_assoc($result) ;if($peopledid==0){echo '单子已完成';header('refresh:0; url=main.php');}else{if($row['num']>=$num){$numcha=$row['num']-$num;$peopledid=0;$result1 = mysqli_query($link, "update woods  set num='$numcha'  where name= '$name' ");$result2 = mysqli_query($link, "update  needs set peopledid='$peopledid'  where  id='$id' ");header('refresh:3; url=main.php');echo '出货成功,3秒后返回管理员界面' ;}else{header('refresh:3; url=main.php');echo $peoplename,'货源不足,无法出货,3秒后返回管理员界面';}}mysqli_close($link);
}
?>

7.buhuo.php

用于填写补货数目

<!--补货响应--><?php header('Content-type:text/html; charset=utf-8');
//接受用户的选择
if (isset($_POST['buhuo'])) {$name = trim($_POST['name']);$id = trim($_POST['id']);?><fieldset><legend>补货清单</legend>
<table ><!-- 管理员补货表-->
<tr><td>物品编号</td><td>物品名称</td><td>补货数目</td><tr>
<form action="buhuo2.php" method="post">
<tr>
<td><input name="id" readonly="readonly"  value="<?php echo $id; ?>"></td>
<td><input type="text" size="6" readonly="readonly" name="name" value="<?php echo "{$name}";?>"></td>
<td><input type="text" size="6" name="num" value=""></td>
<td><input type="submit" name="buhuo" value="确定补货"></td>
<tr/>
</form></table></fieldset><?php
}
?>

8.buhuo2.php

用于对补货进行操作

<!--补货操作-->
<?php
header('Content-type:text/html; charset=utf-8');
if (isset($_POST['buhuo'])) {$name = trim($_POST['name']);$num = trim($_POST['num']);$id = trim($_POST['id']);$link = mysqli_connect( 'localhost' , 'root', '' , 'test' );   if (!$link) {  printf("Can't connect to MySQL Server. Errorcode: %s ", mysqli_connect_error()); exit; }else{ //echo'数据库连接成功';}mysqli_query($link,'set names utf8');    //解决中文乱码的问题$result = mysqli_query($link, "select * from woods WHERE id='$id' ");$row = mysqli_fetch_assoc($result) ;if($num=="" || $id=="" || $name=="" || $num<=0){echo '数据错误,3秒后返回管理员界面';header('refresh:3;url=main.php');exit;}
echo $id;
echo $num,$row['num'];$num2=$num+$row['num'];
echo $num2;$result1 = mysqli_query($link, "update woods  set num='$num2'  where name= '$name' ");if($result1){echo'补货成功,3秒后返回管理员界面';header('refresh:3;url=main.php');exit;}else{echo $name,'补货失败,3秒后返回管理员界面';header('refresh:3;url=main.php');exit;}mysqli_free_result($result); }
?>

二:数据库设计

1.user表

由用户名:user ,密码: passwd组成。

user,主键,类型为char,长度根据需求自选,个人为6。

passwd,类型为char,长度根据需求自选,个人为6。

user表用于存储管理员账号

2.woods表

由物品id:id ,物品名称: name,物品数目:num组成。

id,主键,自增,类型为int ,长度默认。

name,类型char,长度20。

num,类型int,长度默认。

用于存储已有物品

3.needs表

由物品id:id ,物品名称: name,申请人:peoplename,物品数目:num,申请时间:peopledate,是否出货:peopledid组成。

id,主键自增,类型int,长度默认。

name,类型char,长度20。

peoplename,类型char,长度20。

num,类型int,长度默认。

peopledate,类型datetime。

peopledid,类型int,长度默认。

一个简单的出货补货网页php相关推荐

  1. 一个简单的税利计算器(网页版)

    嗯嗯,做一个简单的网页版的税率计算器,功能比较简单,但是相对比较实用.因为参考了一些其他作品,所以在计算汇率的时候习惯性的是以美元做单位.具体的功能有着较为详细的标注.仅供大家学习参考下. <! ...

  2. 利用cookie和jsp写一个简单的登录判断的网页,并获取上次的登录的时间。

    要求:因为只是简单制作,没必要连数据库,直接用确定值去判断.然后就是第一次登录的时候需要获取到登录的时间,然后在下次登录的时候将上次获取到的时间输出. 思路:首先第一个,第一次登录的jsp(姑且当做注 ...

  3. 一个简单的个人介绍html网页制作

    目录 实验说明 网页制作 实验说明 1.环境:本实验用的windows 环境:ubantu 下载安装nginx参考:https://blog.csdn.net/qq_23832313/article/ ...

  4. 使用HBuilder制作一个简单的HTML5动漫网页——铠甲战士

    ⛵ 源码获取 文末联系 ✈ Web前端开发技术 描述 网页设计题材,DIV+CSS 布局制作,HTML+CSS网页设计期末课程大作业 | 网页设计作业 | 动漫网页设计 | 动漫网页设计成品 | 动漫 ...

  5. 制作一个简单HTML红色喜庆邀请函网页(HTML+CSS)

    ⛵ 源码获取 文末联系 ✈ Web前端开发技术 描述 网页设计题材,DIV+CSS 布局制作,HTML+CSS网页设计期末课程大作业 | 茶文化网站 | 中华传统文化题材 | 京剧文化水墨风书画 | ...

  6. 用HTML+CSS做一个简单好看的校园社团网页

    ⛵ 源码获取 文末联系 ✈ Web前端开发技术 描述 网页设计题材,DIV+CSS 布局制作,HTML+CSS网页设计期末课程大作业 | 校园班级网页设计 | 我的班级网页 | 我的学校 | 校园社团 ...

  7. 制作一个简单HTML传统端午节日网页(HTML+CSS)7页 带报告

    ⛵ 源码获取 文末联系 ✈ Web前端开发技术 描述 网页设计题材,DIV+CSS 布局制作,HTML+CSS网页设计期末课程大作业 | 传统春节网页设计 | 圣诞节节日发展 | 中秋 | 端午传统节 ...

  8. 使用HBuilder制作一个简单的HTML5动漫网页——小林家的龙女仆 HTML+CSS学生个人网页制作 学生静态HTML网页源码 dreamweaver网页作业 简单网页课程成品

    HTML实例网页代码, 本实例适合于初学HTML的同学.该实例里面有设置了css的样式设置,有div的样式格局,这个实例比较全面,有助于同学的学习,本文将介绍如何通过从头开始设计个人网站并将其转换为代 ...

  9. 【HTML5期末大作业】制作一个简单HTML我的班级网页(HTML+CSS+JS

    源码获取 文末联系

  10. 制作一个简单HTML抗疫逆行者网页作业(HTML+CSS)

最新文章

  1. Spring注解之 @EnableScheduling计划任务注解
  2. 反欺诈之地址的处理和使用
  3. wxWidgets:wxChoicebook类用法
  4. SOFA 源码分析 — 连接管理器
  5. HDU6218 2017ACM/ICPC亚洲区沈阳站 Bridge(Set,线段树)
  6. Easyfi遭受黑客攻击,被盗600万美元稳定币以及298万个EASY代币
  7. Ubuntu 16.04 GNOME无法使用拼音输入法问题
  8. VS2010调用python编写的代码error:cannot open file 'python27_d.lib'.
  9. 华为交换机初始化和配置SSH和TELNET远程登录方法
  10. Kali 暴力破解wifi密码
  11. 我的她 —— 记我的 IBM R51
  12. reactjs setState的两种写法
  13. redis限制set大小_redis set大小限制_微信文件大小限制
  14. 声网3D在线互动场景空间音频的实时渲染——如何把“声临其境”推向极致
  15. 零数科技创新金融案例入选《2022全球区块链创新应用示范案例集》
  16. Latex 公式 语法 [维基百科]
  17. 大sd卡 裂开了,写保护掉了。重新装好后,被写保护的解决办:
  18. 音视频基础概念(3)——音视频编码与音视频容器
  19. 2020年魔兽联盟优势服务器,商业化的《魔兽世界》怀旧服,2020年又会带给我们怎样的惊喜?...
  20. 2019最新某图灵系列丛书(交互设计、编程、大数据、人工智能等)

热门文章

  1. 常见的两种解空间 全排列与幂集
  2. oracle12c关闭cdb,oracle12c CDB与PDB 启动与关闭操作
  3. 系统win8 任务栏消失不见的解决办法
  4. 看完电影《门锁》感觉脊背发凉,智慧园区带来安全感
  5. 非法使用爬虫,一互联网公司被端,警方上门,23人被带走…
  6. 搜集各种稀奇古怪的编码
  7. 地震 位错模型 matlab,地球物理学论文范文参考 地球物理学毕业论文范文[精选]...
  8. Python用QQ邮箱发送邮件,支持抄送和附件
  9. leetcode:买卖股票的最佳时机含手续费(python)
  10. c语言对称矩形的判定,江苏省扬州市仪征市2017年中考数学一模试卷(含解析).doc...