D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
lampp
/
htdocs
/
admin
/
Filename :
product.php
back
Copy
<?php include('session.php'); if(!isset($_SESSION['login_user'])){ header("location: index.php"); // Redirecting To Home Page } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Add, Edit, Delete Data</title> <link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="screen"> <link rel="stylesheet" type="text/css" href="css/DT_bootstrap.css"> <link href="modal/css1/bootstrap1.css" rel="stylesheet" type="text/css" media="screen"> <link href="css/style.css" rel="stylesheet" type="text/css"> </head> <body> <div class="row-fluid"> <div class="span12"> <div class="container"> <header style="display:flex;align-items:center"> <h3>Welcome to <?php echo $login_session; ?></h3> <div class="flex-spacer"></div> <b class="btn btn-danger" id="logout"><a href="logout.php">Log Out</a></b> </header> <header style="display:flex;align-items:center"> <nav style="display:flex;align-items:center"> <a class="menus"><?php include ('modal_add.php'); ?></a> <div class="flex-spacer"></div> <a class="menus"><?php include ('change_Address.php'); ?></a> <a class="menus"><?php include ('about.php'); ?></a> <a class="menus btn btn-primary" href="gallery.php" >Gallery</a> </nav> </header> <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example"> <div class="alert alert-info"> <strong><i class="icon-user icon-large"></i> Products For Show</strong> </div> <thead> <tr> <th style="text-align:center;"> Image</th> <th style="text-align:center;">Title</th> <th style="text-align:center;">Description</th> <th style="text-align:center;">Action</th> </tr> </thead> <tbody> <?php require_once('db.php'); $result = $conn->prepare("SELECT * FROM add_product ORDER BY product_id ASC"); $result->execute(); for($i=0; $row = $result->fetch(); $i++){ $id=$row['product_id']; ?> <tr> <td style="text-align:center; margin-top:10px; word-break:break-all; width:450px; line-height:100px;"> <?php if($row['product_img'] != ""): ?> <img src="uploads/<?php echo $row['product_img']; ?>" width="100px" height="100px" style="border:1px solid #333333;"> <?php else: ?> <img src="images/default.png" width="100px" height="100px" style="border:1px solid #333333;"> <?php endif; ?> </td> <td style="text-align:center; word-break:break-all; width:200px;"> <?php echo $row ['product_title']; ?></td> <td style="text-align:center; word-break:break-all; width:400px;"> <?php echo $row ['product_desc']; ?></td> <td style="text-align:center; width:350px;"> <a href="#updte_img<?php echo $id;?>" data-toggle="modal" class="btn btn-warning" >Update Image</a> <a href="#delete<?php echo $id;?>" data-toggle="modal" class="btn btn-danger" >Delete </a> </td> </tr> <!-- Modal --> <div id="delete<?php echo $id;?>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <h3 id="myModalLabel">Delete</h3> </div> <div class="modal-body"> <div class="alert alert-danger"> <?php if($row['product_img'] != ""): ?> <img src="uploads/<?php echo $row['product_img']; ?>" width="100px" height="100px" style="border:1px solid #333333;"> <?php else: ?> <img src="images/default.png" width="100px" height="100px" style="border:1px solid #333333; margin-left:15px;"> <?php endif; ?> <b style="color:blue; margin-left:25px; font-size:30px;"><?php echo $row['product_title']." "; ?></b> <br /> <p style="font-size: larger; text-align: center;">Are you Sure you want to Delete?</p> </div> <hr> <div class="modal-footer"> <button class="btn btn-inverse" data-dismiss="modal" aria-hidden="true">No</button> <a href="delete.php<?php echo '?product_id='.$id; ?>" class="btn btn-danger">Yes</a> </div> </div> </div> <!-- Modal Update Image --> <div id="updte_img<?php echo $id;?>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <h3 id="myModalLabel">Update</h3> </div> <div class="modal-body"> <div class="alert alert-danger"> <?php if($row['product_img'] != ""): ?> <img src="uploads/<?php echo $row['product_img']; ?>" width="100px" height="100px" style="border:1px solid #333333; margin-left: 30px;"> <!-- <?php //else: ?> --> <!-- <img src="images/default.png" width="100px" height="100px" style="border:1px solid #333333; margin-left: 30px;"> --> <?php endif; ?> <form action="edit_PDO.php<?php echo '?product_id='.$id; ?>" method="post" enctype="multipart/form-data"> <div style="color:blue; margin-left:150px; font-size:30px;"> <input type="file" name="image" style="margin-top:-115px;" required> <label>Title</label> <input type="text" name="product_title" placeholder="Product Title" value="<?php echo $row['product_title']; ?>" required /> <label>Description</label> <textarea type="text" name="product_desc" placeholder = "Product Description" rows="10" required> <?php echo $row['product_desc']; ?> </textarea> </div> <hr> <div class="modal-footer"> <button class="btn btn-inverse" data-dismiss="modal" aria-hidden="true">No</button> <button type="submit" name="submit" class="btn btn-danger">Yes</button> </form> </div> </div> </div> <?php } ?> </tbody> </table> </div> </div> </div> </div> <script src="modal/js1/jquery1.js" type="text/javascript"></script> <script src="modal/js1/bootstrap1.js" type="text/javascript"></script> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/bootstrap.js" type="text/javascript"></script> <script type="text/javascript" charset="utf-8" language="javascript" src="js/jquery.dataTables.js"></script> <script type="text/javascript" charset="utf-8" language="javascript" src="js/DT_bootstrap.js"></script> </body> </html>