Mini Shell

Direktori : /home/haworld/www/admin/
Upload File :
Current File : /home/haworld/www/admin/contact-edit.php

<!DOCTYPE html>
<html lang="en">

<head>
    <?php include('include/head_admin.php');
    $page_id = '20';

    $address = '';
    $address2 = '';
    $phone = '';
    $phone2 = '';
    $phone3 = '';
    $map = '';
    $email = '';
    $footer_about = '';
    $location = '';
    $short_address = '';
    $facebook = '';
    $insta = '';
    $twitter = '';

    if (isset($_GET['id']) && $_GET['id'] != '') {
        $id = get_safe_value($con, $_GET['id']);
        $image_required = '';
        $res = mysqli_query($con, "select * from info_co where id='$id'");
        $check = mysqli_num_rows($res);
        if ($check > 0) {
            $row = mysqli_fetch_assoc($res);
            $address = $row['address'];
            $address2 = $row['address2'];
            $phone = $row['phone'];
            $phone2 = $row['phone2'];
            $phone3 = $row['phone3'];
            $map = $row['map'];
            $email = $row['email'];
            $footer_about = $row['footer_about'];
            $location = $row['location'];
            $short_address = $row['short_address'];
            $facebook = $row['facebook'];
            $insta = $row['insta'];
            $twitter = $row['twitter'];
        } else {
            header('location:contact.php');
            die();
        }
    }

    if (isset($_POST['submit_contact'])) {
        // prx($_POST);
        $address = get_safe_value($con, $_POST['address']);
        $address2 = get_safe_value($con, $_POST['address2']);
        $phone = get_safe_value($con, $_POST['phone']);
        $phone2 = get_safe_value($con, $_POST['phone2']);
        $phone3 = get_safe_value($con, $_POST['phone3']);
        $map = get_safe_value($con, $_POST['map']);
        $email = get_safe_value($con, $_POST['email']);
        $footer_about = get_safe_value($con, $_POST['footer_about']);
        $location = get_safe_value($con, $_POST['location']);
        $short_address = get_safe_value($con, $_POST['short_address']);
        $facebook = get_safe_value($con, $_POST['facebook']);
        $insta = get_safe_value($con, $_POST['insta']);
        $twitter = get_safe_value($con, $_POST['twitter']);
        $msg = "";

        if ($msg == '') {
            if (isset($_GET['id']) && $_GET['id'] != '') {

                $update_query = "UPDATE `info_co` SET `address`='$address',`address2`='$address2', `phone`='$phone',`phone2`='$phone2', `phone3`='$phone3', `map`='$map', `email`='$email' ,`footer_about`='$footer_about' ,`location`='$location' ,`short_address`='$short_address' ,`facebook`='$facebook', `insta`='$insta', `twitter`='$twitter' WHERE `id`='$id'";

                mysqli_query($con, $update_query);
            } else {
                $insert_query = "INSERT INTO `info_co` ( `address`, `address2`, `phone`, `phone2`, `phone3`,`map`, `email`, `footer_about`, `location`, `short_address`, `facebook`, `insta`, `twitter`)
                VALUES ('$address', '$address2','$phone','$phone2', '$phone3', '$map', '$email', '$footer_about', '$location','$short_address','$facebook', '$insta','$twitter')";
                mysqli_query($con, $insert_query);
                print_r($insert_query);
            }

            header('location: contact.php');
            die();
        }
    }

    ?>
</head>

<body>
    <!--== MAIN CONTRAINER ==-->
    <?php include('include/header_admin.php'); ?>

    <!--== BODY CONTNAINER ==-->
    <div class="container-fluid sb2">
        <div class="row">

            <?php include('include/sidebar_admin.php'); ?>

            <div class="sb2-2">
                <div class="sb2-2-2">
                    <ul>
                        <li><a href="index.php"><i class="fa fa-home" aria-hidden="true"></i> Home</a>
                        </li>

                        <!-- <li class="page-back"><a href="index.php"><i class="fa fa-backward" aria-hidden="true"></i> Back</a>
                        </li> -->
                    </ul>
                </div>
                <div class="sb2-2-add-about sb2-2-1">
                    <div class="box-inn-sp">
                        <div class="bor">
                            <form method="post" enctype="multipart/form-data">


                                <div class="row">
                                    <div class="input-field col s12">
                                        <input id="address" type="text" name="address" class="validate" value="<?php echo $address ?>" required>
                                        <label for="address">Address</label>
                                    </div>
                                    <div class="input-field col s12">
                                        <input id="address2" type="text" name="address2" class="validate" value="<?php echo $address2 ?>" required>
                                        <label for="address2">Address2</label>
                                    </div>
                                    <div class="input-field col s12">
                                        <input id="phone" type="text" name="phone" class="validate" value="<?php echo $phone ?>" required>
                                        <label for="phone">Phone</label>
                                    </div>
                                    <div class="input-field col s12">
                                        <input id="phone2" type="text" name="phone2" class="validate" value="<?php echo $phone2 ?>" required>
                                        <label for="phone2">Phone2</label>
                                    </div>
                                    <div class="input-field col s12">
                                        <input id="phone3" type="text" name="phone3" class="validate" value="<?php echo $phone3 ?>" required>
                                        <label for="phone3">Phone3</label>
                                    </div>

                                    <div class="input-field col s12">
                                        <input id="email" type="text" name="email" class="validate" value="<?php echo $email ?>" required>
                                        <label for="email">Email</label>
                                    </div>

                                    <div class="input-field col s12">
                                        <input id="map" type="text" name="map" class="validate" value="<?php echo $map ?>" required>
                                        <label for="map">Map</label>
                                    </div>
                                    <div class="input-field col s12">
                                        <input id="short_address" type="text" name="short_address" class="validate" value="<?php echo $short_address ?>" required>
                                        <label for="short_address">Short Address</label>
                                    </div>
                                    <div class="input-field col s12">
                                        <input id="location" type="text" name="location" class="validate" value="<?php echo $location ?>" required>
                                        <label for="location">Location</label>
                                    </div>
                                    <div class="input-field col s12">
                                        <input id="footer_about" type="text" name="footer_about" class="validate" value="<?php echo $footer_about ?>" required>
                                        <label for="footer_about">Footer About</label>
                                    </div>


                                    <div class="input-field col s12">
                                        <input id="facebook" type="text" name="facebook" class="validate" value="<?php echo $facebook ?>">
                                        <label for="facebook">Facebook</label>
                                    </div>
                                    <div class="input-field col s12">
                                        <input id="insta" type="text" name="insta" class="validate" value="<?php echo $insta ?>">
                                        <label for="insta">Instagram</label>
                                    </div>
                                    <div class="input-field col s12">
                                        <input id="twitter" type="text" name="twitter" class="validate" value="<?php echo $twitter ?>">
                                        <label for="twitter">Twitter</label>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="input-field col s12">
                                        <input type="submit" name="submit_contact" class="waves-effect waves-light btn-large" value="Submit">
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <?php include('include/footer_admin.php'); ?>

    <?php include('include/foot_admin.php'); ?>


</body>

</html>