PHP 商品订购信息管理系统 - 添加和显示商品信息
'笔记本电脑', 'price' => 3999, 'origin' => '中国', 'quantity' => 50),
array('name' => '平板电脑', 'price' => 1999, 'origin' => '美国', 'quantity' => 30),
array('name' => '手机', 'price' => 2999, 'origin' => '韩国', 'quantity' => 100),
array('name' => '耳机', 'price' => 299, 'origin' => '中国', 'quantity' => 200),
array('name' => '硬盘', 'price' => 999, 'origin' => '日本', 'quantity' => 80)
);
// 检查用户名和密码
if(isset($_POST['username']) && isset($_POST['password'])){
if($_POST['username'] == $username && $_POST['password'] == $password){
// 登录成功,跳转到商品订购信息录入页面
header('Location: product_add.php');
exit;
}else{
// 登录失败,显示错误信息
$error = '用户名或密码错误!';
}
}
// 检查是否有新增商品数据
if(isset($_POST['name']) && isset($_POST['price']) && isset($_POST['origin']) && isset($_POST['quantity'])){
// 添加商品数据到数组中
$new_product = array(
'name' => $_POST['name'],
'price' => $_POST['price'],
'origin' => $_POST['origin'],
'quantity' => $_POST['quantity']
);
array_push($products, $new_product);
}
?>
商品订购信息管理系统
管理员登录
商品订购信息
| 名称 | 价格 | 产地 | 数量 |
|---|---|---|---|
原文地址: https://www.cveoy.top/t/topic/nG0H 著作权归作者所有。请勿转载和采集!