php添加商品和显示商品的业务逻辑

php添加商品和显示商品的业务逻辑

程序


数据库


数据库字段设计


一个模拟的后台管理和前台登录,后续功能会增加上

登录

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<title>无标题文档</title><link rel="stylesheet" type="text/css" href="/style/common.css"/>
</head>

<body>
<?php 
if (isset($_POST['button'])){ //判断是否点击登录按钮
    //用户输入的用户名和密码
    $username=$_POST['username'];
    $pwd=$_POST['pwd'];
    //连接数据库
    mysql_connect("localhost",'root','root') or die(mysql_errno());
    mysql_select_db("phpmysql");
    mysql_query('set names utf8');
    $sql="select * from user where username='$username' and password ='$pwd'";
    $rs=mysql_query($sql);
    //获取结果集的记录数
    if(mysql_num_rows($rs)==1){
       // echo '登录成功';
       //登录成功后,跳转到商品显示页面;用head跳转,后面跟的是地址
       header('location:showgoods.php');
    }else {
        echo '登录失败';
    }
}

?>
<form name="form1" method="post" action="">
    <table width="500" border="1" align="center">
        <tr>
            <th colspan="2">用户登录</th>
        </tr>
         <tr>	
            <td>用户名:</td>
            <td><input  type="text" name="username" id="username"/></td>
        </tr>
          <tr>
            <td>密码:</td>
            <td><input  type="password" name=
  • 8
    点赞
  • 46
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值