Wednesday, April 6, 2016

Product Manage System on Web (Mobile Product) using PHP & MySQL Part II

In Part II  is mention about visitor site of the website .

1. Home Page

2. Product_detail Page
3. List Product By Category
4. Search Product 's Name

1. Home Page is index.php

index.php
<?php
include_once("config.php");
$sql="select * from tblproduct";
$result=mysql_query($sql,$conn);

$product_result="";

while($row=mysql_fetch_array($result)){
$id=$row['pro_id'];
$img=$row['pro_img'];
$name=$row['pro_name'];
$cate=$row['cat_name'];
$price=$row['pro_price'];
$product_result.="<div class='col-sm-4 col-lg-4 col-md-4'><a href='edit.php?ProID=$id'>".$name.
                    "</a><div class='thumbnail'><a href='product/show.php?ProID=$id'><img src='product/upload/".$img."' width=100></a>".
                    "<div class='caption'><h4 class='pull-right'>".$price.
                    "<h4><a href='#'>".$cate."</a></h4><p>This is a short description. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
                    "."</h4></div></div></div>";
                   
}
?>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Shop Homepage - Start Bootstrap Template</title>

    <!-- Bootstrap Core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="css/shop-homepage.css" rel="stylesheet">

</head>

<body>

    <!-- Navigation -->
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">Start Bootstrap</a>
            </div>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li>
                        <a href="#">About</a>
                    </li>
                    <li>
                        <a href="#">Services</a>
                    </li>
                    <li>
                        <a href="#">Contact</a>
                    </li>
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container -->
    </nav>

    <!-- Page Content -->
    <div class="container">

        <div class="row">

            <div class="col-md-3">
                <p class="lead">LKSP Phone Shop</p>
                <p>
                <form method="get" action="result_search.php">
                <fieldset>
                <input type="text" name="txt_search" id="search_text"
                size="20" style="font-size: 17px"/>
                </fieldset>
                </form>
                </p>
                <div class="list-group">
                   <?php
                    include_once("category.php");
                    echo $result_display;
                    ?>
                  </div>
            </div>

            <div class="col-md-9">

                <div class="row carousel-holder">

                    <div class="col-md-12">
                        <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                            <ol class="carousel-indicators">
                                <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                                <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                                <li data-target="#carousel-example-generic" data-slide-to="2"></li>
                            </ol>
                            <div class="carousel-inner">
                                <div class="item active">
                                    <img class="slide-image" src="img/banner1.jpg" alt="">
                                </div>
                                <div class="item">
                                    <img class="slide-image" src="img/banner2.jpg" alt="">
                                </div>
                                <div class="item">
                                    <img class="slide-image" src="img/banner3.jpg" alt="">
                                </div>
                            </div>
                            <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
                                <span class="glyphicon glyphicon-chevron-left"></span>
                            </a>
                            <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
                                <span class="glyphicon glyphicon-chevron-right"></span>
                            </a>
                        </div>
                    </div>

                </div>

                <div class="row">

                    <?php echo $product_result;?>
                 
                    <div class="col-sm-4 col-lg-4 col-md-4">
                        <div class="thumbnail">
                            <img src="http://placehold.it/320x150" alt="">
                            <div class="caption">
                                <h4 class="pull-right">$74.99</h4>
                                <h4><a href="#">Third Product</a>
                                </h4>
                                <p>This is a short description. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
                            </div>
                            <div class="ratings">
                                <p class="pull-right">31 reviews</p>
                                <p>
                                    <span class="glyphicon glyphicon-star"></span>
                                    <span class="glyphicon glyphicon-star"></span>
                                    <span class="glyphicon glyphicon-star"></span>
                                    <span class="glyphicon glyphicon-star"></span>
                                    <span class="glyphicon glyphicon-star-empty"></span>
                                </p>
                            </div>
                        </div>
                    </div>

                    <div class="col-sm-4 col-lg-4 col-md-4">
                        <h4><a href="#">Like this template?</a>
                        </h4>
                        <p>If you like this template, then check out <a target="_blank" href="http://maxoffsky.com/code-blog/laravel-shop-tutorial-1-building-a-review-system/">this tutorial</a> on how to build a working review system for your online store!</p>
                        <a class="btn btn-primary" target="_blank" href="http://maxoffsky.com/code-blog/laravel-shop-tutorial-1-building-a-review-system/">View Tutorial</a>
                    </div>

                </div>

            </div>

        </div>

    </div>
    <!-- /.container -->

    <div class="container">

        <hr>

        <!-- Footer -->
        <footer>
            <div class="row">
                <div class="col-lg-12">
                    <p>Copyright &copy; Your Website 2014</p>
                </div>
            </div>
        </footer>

    </div>
    <!-- /.container -->

    <!-- jQuery -->
    <script src="js/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="js/bootstrap.min.js"></script>

</body>

</html>
------------------------------------------------------------------------------------------

2. Product's Description Page is detail_product.php

detail_product.php
<?php
include_once('../config.php');
$id1=$_GET['ProID'];
$query="select * from tblproduct where pro_id='$id1'";
$result=mysql_query($query,$conn);
while($row=mysql_fetch_assoc($result)){
$id=$row['pro_id'];
$name=$row['pro_name'];
$cate=$row['cat_name'];
$img=$row['pro_img'];
$price=$row['pro_price'];
}
echo $name ;
?>
<html>
<head><title>Edit Product</title>
<?php
if(isset($_POST['delete'])){
include_once"delete.php";
}
else if(isset($_POST['update'])) 
include_once('../config.php');
$name1 = $_POST['txtname'];
$cate1 = $_POST['cate'];
$img1 = $_FILES['files']['name'];
$price1 = $_POST['txtprice'];
$folder="upload/";
move_uploaded_file($_FILES['files']['tmp_name'],$folder.$img1);

$sql="UPDATE tblproduct
SET pro_name='$name1',cat_name='$cate1',
pro_img='$img1',pro_price='$price1' 
WHERE pro_id='$id1'";
$result1=mysql_query($sql,$conn);
if(!$result1){
echo"error".mysql_error();
}
echo"success update";
include_once('show.php');
}
else{
?>
</head>
<body>
<form method="post" action="<?php $_PHP_SELF ?>" enctype="multipart/form-data">
<table border="0">
<tr><td>Product name</td>
<td><input type="text" name="txtname" value="<?php echo $name; ?>"></td></tr>
<tr><td>category</td>
<td><input type="text" value="<?php echo $cate; ?>">
<select name="cate">
<?php 
include_once"../cate.php";
echo $cateset;?>
</select>
</td></tr>
<tr><td>Image</td>
<td><input type="file" name="files"></td></tr>
<tr><td>Price</td>
<td><input type="text" name="txtprice" value="<?php echo $price; ?>"></td></tr>
<tr><td><input type="submit" name="update" value="Edit"></td>
<td><input type="submit" name="delete" value="delete"></td></tr>
</table>
</form>
<table align="left" border="1">
<tr><td><?php echo "<img src='upload/$img' width=100>"?></td></tr>
</table>
<?php 
?>

</body>
</html>

3. List Product By Category


4. Search Product 's Name



No comments:

Post a Comment