Google
Edit File: view_brands.php
<?php include 'session.php'; ini_set("display_errors", 0); include 'reader.php'; //$dbl = new ConDB(); $sessionQuery = "select username from admin_pass"; //$sessionResult = mysql_query($accQry, $db1->conn); if(!$sessionResult = $db1->db->query($sessionQuery)){ die('There was an error running the query [' . $db1->db->error . ']'); } $row = $sessionResult->fetch_assoc(); //$row = mysql_fetch_assoc($sessionResult); //if ($row['session'] == $_SESSION["keys"]) { //} else { //$row = $sessionResult->fetch_assoc(); if ($row['username'] == $_SESSION["keys"]) { } else { // header("Location: login.php"); } $event_id = $_GET['event_id'] ; ?> <?php if (isset($_POST["brand_add"])) { $brand_name = $_POST["name1"]; $uploaddir = './uploads/'; $filename = basename($_FILES['pic']['name']); $raw = $uploaddir . $filename; if (move_uploaded_file($_FILES['pic']['tmp_name'], $raw)) { // $url = "http://localhost/pinaccle".$raw; $url = "http://".$_SERVER['HTTP_HOST']."/admin/pinaccle/".$raw; } $accQry1 = "insert into brand(brand_name,brand_logo,state,created_dt,modified_dt)values('$brand_name','$url',1,NOW(),NOW())"; // $result1 = mysql_query($accQry1, $db1->conn) ; if(!$result1 = $db1->db->query($accQry1)){ die('There was an error running the query [' . $dbl->db->error . ']'); } } if (isset($_POST["brand_edit"])) { $brand_id = $_POST['brand_name1']; $brand_name = $_POST['brand_name2']; $uploaddir = './uploads/'; $filename = basename($_FILES['pic1']['name']); $raw = $uploaddir . $filename; if (move_uploaded_file($_FILES['pic1']['tmp_name'], $raw)) { $url = "http://".$_SERVER['HTTP_HOST']."/admin/pinaccle/".$raw; } $accqry2 = "update brand set brand_name = '$brand_name',modified_dt= NOW(),brand_logo= '$url' where brand_id ='$brand_id'"; if(!$result2 = $db1->db->query($accqry2)){ die('There was an error running the query [' . $dbl->db->error . ']'); } } ?> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Event-Brands Details</title> <link type="text/css" href="css/bootstrap.min.css" rel="stylesheet"> <link type="text/css" href="css/bootstrap-responsive.min.css" rel="stylesheet"> <link type="text/css" href="css/theme.css" rel="stylesheet"> <link type="text/css" href="images/icons/css/font-awesome.css" rel="stylesheet"> <link type="text/css" href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,400,600' rel='stylesheet'> <link type="text/css" href="css/admin_menu_edit.css" rel="stylesheet"> <link type="text/css" href="css/switch.css" rel="stylesheet"> <style type="text/css"> #events_id { color:#fff; }a:focus,a:hover{ color:black; text-decoration:none; } .dropdown-menu>li{ float:none; } .close { color: #000000; opacity: 1; } </style> </head> <body> <div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container" style="min-height: 50px;"> <a class="brand" href="merchant.php"> Pinnacle </a> <ul style="list-style-type: none;text-decoration:none;color:black;float:right;padding-top:10px;"> <li class="dropdown" style="padding-top:10px;"> <a class="dropdown-toggle" role="button" data-toggle="dropdown" href="#" style="color:black;"> <b><?php echo $login_session; ?></b><span class="caret"></span></a> <ul id="g-account-menu" class="dropdown-menu" role="menu"> <li><a href="logout.php">Logout</a></li> </ul> </li> </ul> </div> </div><!-- /navbar-inner --> </div><!-- /navbar --> <div class="wrapper"> <div class="container"> <div class="row"> <div> <?php include ('menu.php'); ?> </div> </div><br /> <div class="row"> <div> <div class="content"> <div class="module"> <div class="module-head"> <h3>Event Brands</h3> </div> </div> <div class="module"> <div class="module-head"> </div> <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <br> <div class=" col-sm-10 col-sm-offset-2" align="center"> <h4 id="myModalLabel">Add Brand</h4></div> </div> <div class="form-group col-sm-10 col-sm-offset-2" align="center"> <form action="" method ="post" enctype="multipart/form-data"> <br> <div class="form-group" id ="form1"> <label class="control-label" for="name">Brand Name:</label> <input type="text" class="form-control" id="email" placeholder="Name" name="name1" > </div> <br> <label class="control-label" for="email">Brand Logo:</label> <br> <div class="form-group" id ="form2"> <input type="file" name="pic" > </div> <br> <button type="submit" name="brand_add" class="btn btn-default col-sm-12" style="width:40%;">Add</button> <br><br><br><br><br><br> </form> </div> </div> <div id="myModal1" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 id="myModalLabel"></h3> </div> <div class="form-group col-sm-10 col-sm-offset-2" align="center"> <form action="" method ="post"> <div class="form-group" id ="form1"> <label class="control-label" for="name">Event Id:</label> <input type="text" class="form-control" id="event_id" placeholder="Id" name="event_nameid" > </div> <div class="form-group" id ="form1"> <label class="control-label" for="name">Event Name:</label> <input type="text" class="form-control" id="name_id" placeholder="Name" name="event_name" > </div> <br> <button type="submit" name="event_edit" class="btn btn-default col-sm-12" style="width:50%;">Submit</button> <br><br><br><br><br><br> </form> </div> </div> <div id="myModal2" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <br> <div class=" col-sm-10 col-sm-offset-2" align="center"> <h4 id="myModalLabel">Edit Brand</h4></div> </div> <div class="form-group col-sm-10 col-sm-offset-2" align="center"> <form action="" method ="post" enctype="multipart/form-data"> <br> <div class="form-group" id ="form1"> <label class="control-label" for="name"></label> <input type="text" class="form-control" id="brand_id" placeholder="Name" name="brand_name1" > </div> <div class="form-group" id ="form1"> <label class="control-label" for="name">Brand Name:</label> <input type="text" class="form-control" id="brand_id1" placeholder="Name" name="brand_name2" > </div> <br> <label class="control-label" for="email">Brand Logo:</label> <br> <div class="form-group" id ="form2"> <input type="file" name="pic1" > </div> <br> <button type="submit" name="brand_edit" class="btn btn-default col-sm-12" style="width:40%;">Update</button> <br><br><br><br><br><br> </form> </div> </div> <div class="module-body table"> <table cellpadding="0" cellspacing="0" border="0" class="datatable-1 table table-bordered table-striped display" width="100%"> <thead> <tr> <th>Sl No:</th> <th>Brand Name</th> <th>Brand Logo</th> <th>State</th> <th>Created Date</th> <th> Menu Details</th> <th>View Menu Details </th> </tr> </thead> <tbody> <?php $accQry2 = "select b.brand_id ,b.brand_name, b.brand_logo,b.state,b.created_dt from brand b inner join event_vendor_map e on b.brand_id = e.brand_id where e.event_id = '$event_id' "; // $result1 = mysql_query($accQry, $db1->conn) ; if(!$result2 = $db1->db->query($accQry2)){ die('There was an error running the query [' . $dbl->db->error . ']'); } $i = 1; while ($row = $result2->fetch_assoc()) { ?> <tr id="doc_rows" > <td class="center"><?Php echo $i ?></td> <td class="center"><?Php if($row['brand_name'] != NULL){echo $row['brand_name'];}else{echo "-";} ?></td> <td class="center"><?Php if($row['brand_logo'] != NULL){ ?> <img src= "<?php echo $row['brand_logo'] ; ?>" alt="Category Image" height="100" width="100"><?php }else{echo "N.A";} ?></td> <td class="center"><?Php if($row['state'] != NULL){echo $row['state'];}else{echo "-";} ?></td> <td class="center"><?Php if($row['created_dt'] != NULL){echo $row['created_dt'];}else{echo "-";} ?></td> <td class="center"><button id="button_id" style="color:white;background-color:#81d1da;" onclick="window.location='view_all_menu.php?brand_id=<?php echo $row['brand_id'] ?>&event_id=<?php echo $event_id ; ?> '" > Menu Details</button></td> <td class="center"><button id="button_id" style="color:white;background-color:#81d1da;" onclick="window.location='view_all_menu_details.php?brand_id=<?php echo $row['brand_id'] ?>&event_id=<?php echo $event_id ; ?> '" >View Menu Details</button></td> </tr> <?php $i++; } ?> </tbody> </table> </div> </div><!--/.module--> <br /> </div><!--/.content--> </div><!--/.span9--> </div> </div><!--/.container--> </div><!--/.wrapper--> <script src="scripts/jquery-1.9.1.min.js"></script> <script src="scripts/jquery-ui-1.10.1.custom.min.js"></script> <script src="js/bootstrap.min.js"></script> <script src="scripts/datatables/jquery.dataTables.js"></script> <script> $(document).ready(function() { $('.datatable-1').dataTable(); $('.dataTables_paginate').addClass("btn-group datatable-pagination"); $('.dataTables_paginate > a').wrapInner('<span />'); $('.dataTables_paginate > a:first-child').append('<i class="icon-chevron-left shaded"></i>'); $('.dataTables_paginate > a:last-child').append('<i class="icon-chevron-right shaded"></i>'); } ); $('#myModal').on('show', function() { var tit = $('.confirm-delete').data('title'); $('#myModal .modal-body p').html("Desea eliminar al usuario " + '<b>' + tit +'</b>' + ' ?'); var id = $(this).data('id'), removeBtn = $(this).find('.danger'); }) $('.confirm-delete').on('click', function(e) { e.preventDefault(); var id = $(this).data('id'); $('#myModal').data('id', id).modal('show'); }); function myFunction(event_id,event_name) { document.getElementById("event_id").value=event_id; document.getElementById("name_id").value=event_name; $('#myModal1').modal('show'); // document.getElementById("merchant_id").style.display="none"; // document.getElementById("form2").style.display="none"; } function edit(brand_id, brand_name) { document.getElementById("brand_id").value=brand_id ; document.getElementById("brand_id1").value=brand_name; $('#myModal2').modal('show'); document.getElementById("brand_id").style.display="none"; } </script> </body>