<?php
include_once("../include/main.inc.php");
check_session('MyCpanel', 'index.php');

if ($_POST['action'] == "Update") {
  @extract($_POST);
  updateTable("admin_details", " name='$name', email='$email', cc='$cc', subject='$subject', website='$website', address='$address', companyName='$companyName', phone='$phone',facebook_link = '$facebook_link', instagram_link = '$instagram_link', linked_link='$linked_link', youtube_link='$youtube_link', twitter_link='$twitter_link',company_video='$company_video',mobile='$mobile', city='$city', state='$state', country='$country' where user_type='admin'");
  $_SESSION['session_message'] = "Admin details have been updated successfully";
  header("Location:" . SITE_ADMIN_URL . "/myaccount.php");
  exit;
}

$res = getResult("admin_details", " where user_type='admin'");
admin_header();
?>
<form name="form1" method="post" action="" onsubmit="return validate(this);">

  <h4 align="center" style="font-weight: 600;
      margin: 10px 10px 15px 15px;
      padding: 10px 15px;
      border: 15px;
      ">Manage Admin Details</h4>

  <?php
  if ($_SESSION['session_message'] != "") {
    ?>
    <center><?php print_message(); ?></center>
    <?php
  }
  ?>
  <div class="form-group">
    <label for="email">Owner Name *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['name']; ?>" placeholder="Owner Name" name="name">   </div>
  <div class="form-group">
    <label for="email">Company Name *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['companyName']; ?>" placeholder="Company Name" name="companyName"> 
  </div>
  <div class="form-group">
    <label for="email">Address 2 *:</label>
    <textarea name="address"  class="form-control txtfieldadmin" rows="5" cols="10"><?= $res['address']; ?></textarea>
  </div>
  <div class="form-group">
    <label for="email">Email Id *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['email']; ?>" placeholder="Email ID" name="email"> 
  </div>
  <div class="form-group">
    <label for="email">Email Id (CC) *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['cc']; ?>" placeholder="Email ID (cc)" name="cc"> 
  </div>
  <div class="form-group">
    <label for="email">Subject *:</label>
    <textarea name="subject"  class="form-control txtfieldadmin" rows="5" cols="10"><?= $res['subject']; ?></textarea>
  </div>
  <div class="form-group">
    <label for="email">Website Name *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['website']; ?>" placeholder="Website Name" name="website"> 
  </div>
  <div class="form-group">
    <label for="email">Company Phone *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['phone']; ?>" placeholder="Company Phone" name="phone"> 
  </div>
  <div class="form-group">
    <label for="email">Mobile Number *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['mobile']; ?>" placeholder="Mobile Number" name="mobile"> 
  </div>

  <div class="form-group">
    <label for="email">City *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['city']; ?>" placeholder="City Name" name="city"> 
  </div>
  <div class="form-group">
    <label for="email">State *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['state']; ?>" placeholder="State Name" name="state"> 
  </div>
  <div class="form-group">
    <label for="email">Country *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['country']; ?>" placeholder="Country Name" name="country"> 
  </div>
      <div class="form-group">
    <label for="email">Facebook Link *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['facebook_link']; ?>" placeholder="Facebook Link" name="facebook_link"> 
  </div>
     <div class="form-group">
    <label for="email">Instagram Link *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['instagram_link']; ?>" placeholder="Instagram Link" name="instagram_link"> 
  </div>
     <div class="form-group">
    <label for="email">Youtube Link *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['youtube_link']; ?>" placeholder="Youtube Link" name="youtube_link"> 
  </div>
     <div class="form-group">
    <label for="email">Linked-in Link *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['linked_link']; ?>" placeholder="Linked-in Link" name="linked_link"> 
  </div>
     <div class="form-group">
    <label for="email">Twiiter Link *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['twitter_link']; ?>" placeholder="Twitter Link" name="twitter_link"> 
  </div>
  <div class="form-group">
    <label for="email">Company Video link *:</label>
    <input type="text" class="form-control txtfieldadmin" value="<?= $res['company_video']; ?>" placeholder="company_video" name="company_video"> 
  </div>

    <input type="hidden" name="action" value="Update">
    <input name="f2" type="submit" class="button btn btn-success" value="Submit">  </td>

    </form>
    <?php
    admin_footer();
    exit;
    ?>