Google
Edit File: event_new.php
<?php include 'session.php';?> <!DOCTYPE html> <?php 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"); } ?> <?php if (isset($_POST["event_add"])) { echo "k"; $event_name1 = $_POST["event_name1"]; $from = $_POST['from']; $to = $_POST['to']; echo "i"; $time_from = $_POST['timefrom']; $time_to = $_POST['timeto']; $uploaddir = './uploads/'; $filename = basename($_FILES['pic']['name']); $raw = $uploaddir . $filename; if (move_uploaded_file($_FILES['pic']['tmp_name'], $raw)) { $url = "http://localhost/pinaccle".$raw; } echo "l"; $accQry2 = "insert into event(event_name,event_logo,state,created_dt,modified_dt,start_dt,end_dt,start_time,end_time)values('$event_name1','$url',1,NOW(),NOW(),'$from','$to','$time_from','$time_to')"; // $result1 = mysql_query($accQry2, $db1->conn) ; if(!$result2 = $db1->db->query($accQry2)){ die('There was an error running the query [' . $dbl->db->error . ']'); } } if (isset($_POST["event_edit"])) // var_dump($_POST); { echo "k"; $event_id = $_POST['event_nameid']; echo "k"; $event_name = $_POST['event_name']; $start_date = $_POST['from2']; $end_date = $_POST['to2']; $start_time = $_POST['timefrom2']; $end_time = $_POST['timeto2']; $uploaddir = './uploads/'; $filename = basename($_FILES['upload']['name']); $raw = $uploaddir . $filename; if (move_uploaded_file($_FILES['upload']['tmp_name'], $raw)) { $url = "http://localhost/pinaccle".$raw; } $accQry6 = "update event set event_name='$event_name',state=1,created_dt=NOW(),modified_dt=NOW(),event_logo='$url',start_dt='$start_date',end_dt='$end_date',start_time='$start_time',end_time='$end_time' where event_id ='$event_id'"; // $result = mysql_query($accQry, $db1->conn) ; if(!$result6 = $dbl->db->query($accQry)){ 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>Pinnacle</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"> #users{ 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> </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>Events</h3> <a href="javascript:void(0);" data-toggle="modal" data-target="#myModal">Add New</a> </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 Event</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 style =display:inline;" class="control-label" for="name">Event Name:</label> <input type="text" class="form-control" id="email" placeholder="Name" name="event_name1" > </div> <br> <div class="form-group" > <label style="display:inline;" for="from">From </label> <input type="text" id="from" value="" name="from"> </div> <br> <div> <label style="display:inline;" for="to">to </label> <input type="text" id="to" value="" name="to"> </div> <br> <div> <label style="display:inline;">Time from </label> <input class="custom" type='time' value='now' name = "timefrom" /> </div> <br> <div> <label style="display:inline;">Time Till </label> <input class="custom" type='time' value ='now' name="timeto" /> </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="event_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> <br> <div class=" col-sm-10 col-sm-offset-2" align="center"> <h4 id="myModalLabel">Edit Event</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="event_id" placeholder="Id" name="event_nameid" > </div> <div class="form-group" id ="form1"> <label style= "display:inline" class="control-label" for="name">Event Name:</label> <input type="text" class="form-control" id="name_id" placeholder="Name" name="event_name" > </div><br> <div class="form-group" > <label style="display:inline;" for="from">From </label> <input type="text" id="from_id2" value="" name="from2"> </div> <br> <div> <label style="display:inline;" for="to">to </label> <input type="text" id="to_id2" value="" name="to2"> </div> <br> <div> <label style="display:inline;">Time from </label> <input class="custom" type='time' id ="time_id" value='now1' name = "timefrom2" /> </div> <br> <div> <label style="display:inline;">Time Till </label> <input class="custom" type='time' id="time_id2" value ='now1' name="timeto2" /> </div> <br> <div class="form-group" id ="form2"> <input type="file" name="upload" > </div> <br> <button type="submit" name="event_edit" class="btn btn-default col-sm-12" style="width:40%;">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">Brand Details</h4></div> </div> <div class="form-group col-sm-10 col-sm-offset-2" align=""> <form action="" method ="post" enctype="multipart/form-data" align=""> <div class="checkbox" > <?php $accQry4 = "select * from brand"; // $result1 = mysql_query($accQry, $db1->conn) ; if(!$result4 = $db1->db->query($accQry4)){ die('There was an error running the query [' . $dbl->db->error . ']'); } $i = 1; while ($row = $result4->fetch_assoc()) { // echo $row['brand_name'] ; ?> <label> <input type="checkbox" value="<?php echo $row['brand_id'] ; ?>" name="chk1[]" ><?php echo $row['brand_name'] ; ?></label> <?php $i++; } ?> </div> <br><br> <button type="submit" name="submit_brand" class="btn btn-default col-sm-12" style="width:40%;">Submit</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>Event Name</th> <th>Event Logo</th> <th>State</th> <th>Start Date</th> <th>End Date</th> <th>Start Time</th> <th>End Time</th> <th>Edit</th> <th>Order Details</th> </tr> </thead> <tbody> <?php $accQry5 = "select * from event"; // $result1 = mysql_query($accQry, $db1->conn) ; if(!$result5 = $db1->db->query($accQry5)){ die('There was an error running the query [' . $db->db->error . ']'); } $i = 1; while ($row = $result5->fetch_assoc()) { ?> <tr id="doc_rows" > <td class="center"><?Php echo $i ?></td> <td class="center"><?Php if($row['event_name'] != NULL){echo $row['event_name'];}else{echo "-";} ?></td> <td class="center"><?Php if($row['event_logo'] != NULL){ ?> <img src= "<?php echo $row['event_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['start_dt'] != NULL){echo $row['start_dt'];}else{echo "-";} ?></td> <td class="center"><?Php if($row['end_dt'] != NULL){echo $row['end_dt'];}else{echo "-";} ?></td> <td class="center"><?Php if($row['start_time'] != NULL){echo $row['start_time'];}else{echo "-";} ?></td> <td class="center"><?Php if($row['end_time'] != NULL){echo $row['end_time'];}else{echo "-";} ?></td> <td class="center"><button id="button_id" onclick="myFunction(<?Php echo "'".$row['event_id']."','".$row['event_name']."','".$row['start_dt']."','".$row['end_dt']."','".$row['start_time']."','".$row['end_time']."' "?>)">Edit</button></td> <td class="center"><button id="button_id" onclick="window.location='per_event_order.php?event_id=<?php echo $row['event_id']?> '" >Order 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> <link href="css/jquery-ui.css" rel="stylesheet"> <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,start_date,end_date,start_time,end_time) { document.getElementById("event_id").value=event_id; document.getElementById("name_id").value=event_name; document.getElementById("from_id2").value=start_date; document.getElementById("to_id2").value=end_date; document.getElementById("time_id").value=start_time; document.getElementById("time_id2").value=end_time; $('#myModal1').modal('show'); // document.getElementById("event_id").value=event_id; // document.getElementById("form2").style.display="none"; } function brand() { $('#myModal2').modal('show'); } $( function() { var from = $( "#from" ) .datepicker({ changeMonth: true, numberOfMonths: 1, dateFormat: 'yy-mm-dd', }) // .on( "change", function() { // to.datepicker( "option", "minDate", getDate( this ) ); // }), to = $( "#to" ).datepicker({ changeMonth: true, numberOfMonths: 1, dateFormat: 'yy-mm-dd', }) // .on( "change", function() { // from.datepicker( "option", "maxDate", getDate( this ) ); // }); function getDate( element ) { var date; try { date = element.value; } catch( error ) { date = null; } return date; } } ); $( function() { var from = $( "#from_id2" ) .datepicker({ changeMonth: true, numberOfMonths: 1, dateFormat: 'yy-mm-dd', }) // .on( "change", function() { // to.datepicker( "option", "minDate", getDate( this ) ); // }), to = $( "#to_id2" ).datepicker({ changeMonth: true, numberOfMonths: 1, dateFormat: 'yy-mm-dd', }) // .on( "change", function() { // from.datepicker( "option", "maxDate", getDate( this ) ); // }); function getDate( element ) { var date; try { date = element.value; } catch( error ) { date = null; } return date; } } ); $(function(){ $('input[type="time"][value="now"]').each(function(){ var d = new Date(), h = d.getHours(), m = d.getMinutes(); if(h < 10) h = '0' + h; if(m < 10) m = '0' + m; $(this).attr({ 'value': h + ':' + m }); }); }); $(function(){ $('input[type="time"][value="now1"]').each(function(){ var d = new Date(), h = d.getHours(), m = d.getMinutes(); if(h < 10) h = '0' + h; if(m < 10) m = '0' + m; $(this).attr({ 'value': h + ':' + m }); }); }); </script> </body>