<?php
include("topmenu.php");

?>

<div class="main_content_iner overly_inner ">
<div class="container-fluid p-0 ">

<div class="row">
<div class="col-12">
<div class="page_title_box d-flex align-items-center justify-content-between">
<div class="page_title_left">
<h3 class="f_s_30 f_w_700 text_white">Home</h3>
<ol class="breadcrumb page_bradcam mb-0">
<li class="breadcrumb-item"><a href="javascript:void(0);">Al Barsha Electronics LLC </a></li>
<li class="breadcrumb-item"><a href="javascript:void(0);">Dashboard</a></li>
<li class="breadcrumb-item active">Home</li>
<li class="breadcrumb-item active">Service</li>
</ol>

</div>
</div>


                    
                        
                    <?php
if(isset($_GET['id']))
{
$id=$_GET['id'];
$s=mysqli_query($db,"select * from service where id='$id'");
$r=mysqli_fetch_row($s);
}
?>

<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-header align-items-center d-flex card-header2">
                <h4 class="card-title mb-0 flex-grow-1">Update Service</h4>
            </div><!-- end card header -->

            <div class="card-body">
                <div class="live-preview">
                    <form method="post" enctype="multipart/form-data">
                        <div class="row gy-4">
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Select service<span class="red">*</span></label>
                                    <select  class="form-control" id="exampleInputdate" name="ss" required>
                                    <?php
            $sse1=mysqli_query($db,"select * from mservice where id=$r[18] ");
            $rse1=mysqli_fetch_row($sse1);
            

            ?>
                                    <option value="<?php echo $rse1[0];?>"><?php echo $rse1[1];?></option>

                                    <?php
            $sse=mysqli_query($db,"select * from mservice ");
            while($rse=mysqli_fetch_row($sse))
            {

            ?>
                                    <option value="<?php echo $rse[0];?>"><?php echo $rse[1];?></option>
                                    <?php
            }
            ?>
                                    
                                    </select>
                            </div>
                        </div> 
                                            <div class="col-lg-3">
                                                <div>  
                                                <label for="labelInput" class="form-label">Image(width-307px & height-260px) <span class="red">*</span></label>
                                                    <input type="file" class="form-control" id="basiInput" name="photo" value="<?php echo $r[1]?>" > 
                                                    <img src="../images/service/<?php echo $r[1]?>" width="100px" height="100px">
                                                </div>
                                            </div>
                                            <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Number<span class="red">*</span></label>
                                <input type="text"  class="form-control" id="exampleInputdate" value="<?php echo $r[2]?>" name="a1" required>
                            </div>
                        </div> 
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Heading 1<span class="red">*</span></label>
                                <input type="text"  class="form-control" id="exampleInputdate" value="<?php echo $r[3]?>" name="a2" required>
                            </div>
                        </div> 
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Heading 2<span class="red">*</span></label>
                                <input type="text"  class="form-control" id="exampleInputdate" value="<?php echo $r[4]?>" name="a3" required>
                            </div>
                        </div> 
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Description<span class="red">*</span></label>
                                <textarea  class="form-control" id="exampleInputdate" name="a4"required> <?php echo $r[5]?> </textarea>
                            </div>
                        </div> 

                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Icon<span class="red">*</span></label>
                                <input type="text"  class="form-control" id="exampleInputdate" value="<?php echo $r[17]?>" name="a14" required>
                            </div>
                        </div> 
                       
</div>
<center>Service Details</center>
<div class="row gy-4">
                        <div class="col-lg-4">
                            <div>  
                            <label for="labelInput" class="form-label">Image(width-640px & height-440px) <span class="red">*</span></label>
                                <input type="file" class="form-control" id="basiInput" name="photo1" value="<?php echo $r[1]?>" > 
                                <img src="../images/service/<?php echo $r[15]?>" width="100px" height="100px">
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div>  
                            <label for="labelInput" class="form-label">Detail page Image(width-491px & height-553px) <span class="red">*</span></label>
                                <input type="file" class="form-control" id="basiInput" name="photo2" value="<?php echo $r[1]?>" > 
                                <img src="../images/service/<?php echo $r[16]?>" width="100px" height="100px">
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Description<span class="red">*</span></label>
                                <textarea  class="form-control" id="exampleInputdate"name="a5" required> <?php echo $r[6]?> </textarea>
                            </div>
                        </div> 

                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 1</label>
                                <input type="text"  class="form-control" id="exampleInputdate" value="<?php echo $r[7]?>" name="a6">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 2</label>
                                <input type="text"  class="form-control" id="exampleInputdate" value="<?php echo $r[8]?>" name="a7">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 3</label>
                                <input type="text"  class="form-control" id="exampleInputdate" value="<?php echo $r[9]?>" name="a8">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 4</label>
                                <input type="text"  class="form-control" id="exampleInputdate" value="<?php echo $r[10]?>" name="a9">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 5</label>
                                <input type="text"  class="form-control" id="exampleInputdate" value="<?php echo $r[11]?>" name="a10">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 6</label>
                                <input type="text"  class="form-control" id="exampleInputdate" value="<?php echo $r[12]?>" name="a11">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 7</label>
                                <input type="text"  class="form-control" id="exampleInputdate" value="<?php echo $r[13]?>" name="a12">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 8</label>
                                <input type="text"  class="form-control" id="exampleInputdate" value="<?php echo $r[14]?>" name="a13">
                            </div>
                        </div> 
                                              

                                            <div class="mt-3">

                                                <!-- <input type="submit" name="" value="Submit" class="btn btn-success waves-effect waves-light"> -->

                                                <input type="submit" class="btn btn-primary"  name="sub" value="Submit">
                                            </div>
                                                 
                </form>
                </div>
                    <!--end row-->
               </div>
            </div>
        </div>   
        
        
        
    </div>
    </div>
            
                    
                   
                    









<?php

if(isset($_POST['sub']))
{
    $ss=addslashes($_POST['ss']);

    $a1=addslashes($_POST['a1']);
    $a2=addslashes($_POST['a2']);
    $a3=addslashes($_POST['a3']);
    $a4=addslashes($_POST['a4']);
    $a5=addslashes($_POST['a5']);
    $a6=addslashes($_POST['a6']);
    $a7=addslashes($_POST['a7']);
    $a8=addslashes($_POST['a8']);
    $a9=addslashes($_POST['a9']);
    $a10=addslashes($_POST['a10']);
    $a11=addslashes($_POST['a11']);
    $a12=addslashes($_POST['a12']);
    $a13=addslashes($_POST['a13']);

    $a14=addslashes($_POST['a14']);
    $fileName1=$_FILES['photo']['name'];
$fileName2=$_FILES['photo1']['name'];
$fileName3=$_FILES['photo2']['name'];







 if(isset($_FILES['photo']['name']) && $_FILES['photo']['name']!="")
    {
        $fileTmpPath1 = $_FILES['photo']['tmp_name'];
        
        $fileSize1 = $_FILES['photo']['size'];
        $fileType1 = $_FILES['photo']['type'];
        $fileNameCmps1 = explode(".", $fileName1);
        $fileExtension1 = strtolower(end($fileNameCmps1));
        
        
        
        $newFileName1 = md5(time() . $fileName1) . '.' . $fileExtension1;
        $allowedfileExtensions1 = array('jpg', 'gif', 'png','jpeg');
        if (in_array($fileExtension1, $allowedfileExtensions1))
        {
        $uploadFileDir1 = "../images/service/"; 
        $dest_path1 = $uploadFileDir1 . $newFileName1;

        list($width, $height, $type, $attr) = getimagesize($fileTmpPath1);
           
        
        if($width=="307" && $height=="260")
        {
        
        
        move_uploaded_file($fileTmpPath1, $dest_path1);
      
        $res2=mysqli_query($db,"UPDATE service SET image='$newFileName1'WHERE id='$id' ");
        msg("Successfully updated","service.php");
        }
        else
        {
        
        
            msg("Image Size should be in width - 307px & height - 260px", "editservice.php?id=$id");
        }

    }
    else
    {
    
    
        msg("Image extension should be jpg or png", "editservice.php?id=$id");
    }
}

    if(isset($_FILES['photo1']['name']) && $_FILES['photo1']['name']!="")
    {
        $fileTmpPath2 = $_FILES['photo1']['tmp_name'];
      
        $fileSize2 = $_FILES['photo1']['size'];
        $fileType2 = $_FILES['photo1']['type'];
        $fileNameCmps2 = explode(".", $fileName2);
        $fileExtension2 = strtolower(end($fileNameCmps2));
        $newFileName2 = md5(time() . $fileName2) . '.' . $fileExtension2;
        
        
        $allowedfileExtensions2 = array('jpg', 'gif', 'png','jpeg');
        if (in_array($fileExtension2, $allowedfileExtensions2))
        {
        $uploadFileDir2 = "../images/service/"; 
        $dest_path2 = $uploadFileDir2 . $newFileName2;

       
        list($width, $height, $type, $attr) = getimagesize($fileTmpPath2);
           
        
        if($width=="640" && $height=="440")
        {
        
        
        move_uploaded_file($fileTmpPath2, $dest_path2);
      
        $res2=mysqli_query($db,"UPDATE service SET img='$newFileName2'WHERE id='$id'");
        msg("Successfully updated","service.php");
        }
        else
        {
        
        
            msg("Image Size should be in width - 640px & height - 440px", "editservice.php?id=$id");
        }

    }
    else
    {
    
    
        msg("Image extension should be jpg or png", "editservice.php?id=$id");
    }
}


if(isset($_FILES['photo2']['name']) && $_FILES['photo2']['name']!="")
    {
        $fileTmpPath3 = $_FILES['photo2']['tmp_name'];
      
        $fileSize3 = $_FILES['photo2']['size'];
        $fileType3 = $_FILES['photo2']['type'];
        $fileNameCmps3 = explode(".", $fileName3);
        $fileExtension3 = strtolower(end($fileNameCmps3));
        $newFileName3 = md5(time() . $fileName3) . '.' . $fileExtension3;
        
        
        $allowedfileExtensions3 = array('jpg', 'gif', 'png','jpeg');
        if (in_array($fileExtension3, $allowedfileExtensions3))
        {
        $uploadFileDir3 = "../images/service/"; 
        $dest_path3 = $uploadFileDir3 . $newFileName3;

       
        list($width, $height, $type, $attr) = getimagesize($fileTmpPath3);
        
        if($width=="491" && $height=="553")
        {
        
        
        move_uploaded_file($fileTmpPath3, $dest_path3);
      
        $res3=mysqli_query($db,"UPDATE service SET img1='$newFileName3'WHERE id='$id'");
        msg("Successfully updated","service.php");
        }
        else
        {
        
        
            msg("Image Size should be in width - 491px & height - 553px", "editservice.php?id=$id");
        }

    }
    else
    {
    
    
        msg("Image extension should be jpg or png", "editservice.php?id=$id");
    }
}



$res=mysqli_query($db,"UPDATE service SET  a1='$a1',a2='$a2',a3='$a3',a4='$a4',a5='$a5',a6='$a6',a7='$a7',a8='$a8',a9='$a9',a10='$a10',a11='$a11',a12='$a12',a13='$a13',ic='$a14',ss='$ss' WHERE id='$id'");

 msg("successfully updated","service.php");
}

?>


</div>
</div>
</div>
</div>
    








<div id="back-top" style="display: none;">
<a title="Go to Top" href="#">
<i class="ti-angle-up"></i>
</a>
</div>

<div class="footer_part">
                <div class="container-fluid">
                <div class="row">
                <div class="col-lg-12">
                <div class="footer_iner text-center">
                <p>2023 © Al Barsha Electronics LLC  - Designed by <a href="https://www.oracuz.com/">Oracuz</a></p>
                </div>
                </div>
                </div>
                </div>
                </div>
                </section>

<script src="js/jquery1-3.4.1.min.js"></script>

<script src="js/popper1.min.js"></script>

<script src="js/bootstrap.min.php"></script>

<script src="js/metisMenu.js"></script>

<script src="vendors/count_up/jquery.waypoints.min.js"></script>

<script src="vendors/chartlist/Chart.min.js"></script>

<script src="vendors/count_up/jquery.counterup.min.js"></script>

<script src="vendors/niceselect/js/jquery.nice-select.min.js"></script>

<script src="vendors/owl_carousel/js/owl.carousel.min.js"></script>

<script src="vendors/datatable/js/jquery.dataTables.min.js"></script>
<script src="vendors/datatable/js/dataTables.responsive.min.js"></script>
<script src="vendors/datatable/js/dataTables.buttons.min.js"></script>
<script src="vendors/datatable/js/buttons.flash.min.js"></script>
<script src="vendors/datatable/js/jszip.min.js"></script>
<script src="vendors/datatable/js/pdfmake.min.js"></script>
<script src="vendors/datatable/js/vfs_fonts.js"></script>
<script src="vendors/datatable/js/buttons.php5.min.js"></script>
<script src="vendors/datatable/js/buttons.print.min.js"></script>

<script src="vendors/datepicker/datepicker.js"></script>
<script src="vendors/datepicker/datepicker.en.js"></script>
<script src="vendors/datepicker/datepicker.custom.js"></script>
<script src="js/chart.min.js"></script>
<script src="vendors/chartjs/roundedBar.min.js"></script>

<script src="vendors/progressbar/jquery.barfiller.js"></script>

<script src="vendors/tagsinput/tagsinput.js"></script>

<script src="vendors/text_editor/summernote-bs4.js"></script>
<script src="vendors/am_chart/amcharts.js"></script>

<script src="vendors/scroll/perfect-scrollbar.min.js"></script>
<script src="vendors/scroll/scrollable-custom.js"></script>

<script src="vendors/vectormap-home/vectormap-2.0.2.min.js"></script>
<script src="vendors/vectormap-home/vectormap-world-mill-en.js"></script>

<script src="vendors/apex_chart/apex-chart2.js"></script>
<script src="vendors/apex_chart/apex_dashboard.js"></script>
<script src="vendors/echart/echarts.min.js"></script>
<script src="vendors/chart_am/core.js"></script>
<script src="vendors/chart_am/charts.js"></script>
<script src="vendors/chart_am/animated.js"></script>
<script src="vendors/chart_am/kelly.js"></script>
<script src="vendors/chart_am/chart-custom.js"></script>

<script src="js/dashboard_init.js"></script>
<script src="js/custom.js"></script>
</body>

<!-- Mirrored from demo.dashboardpack.com/sales.php/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 15 Feb 2023 12:12:37 GMT -->
</html>
