<?php
include('config.php');

if (isset($_POST['upload_vmc'])){
    $vmc_id=mysqli_real_escape_string($db,$_POST['vmc_id']);
    $vmc_text=mysqli_real_escape_string($db,$_POST['vmc_text']);
    $vmc_category=mysqli_real_escape_string($db,$_POST['vmc_category']);
    if ($vmc_category=='resilience' ||$vmc_category=='integrity'||$vmc_category=='commitment'||$vmc_category=='excellence')
    {
        $vmc_category='core value '.$vmc_category;
    }
    $vmc_date_posted=mysqli_real_escape_string($db,$_POST['vmc_date_posted']);

    $vmc_sql="INSERT INTO vmc (vmc_text,vmc_categry,vmc_date_posted)VALUES ('$vmc_text','$vmc_category','$vmc_date_posted')";
    $vmc_result=mysqli_query($db,$vmc_sql);
    if ($vmc_result){
        header("Location:view_vmc.php");
    }
}

$vision_retrieve= " SELECT * FROM vmc where vmc_categry='vision' ORDER BY vmc_id DESC LIMIT 1";
$vision_display=mysqli_query($db,$vision_retrieve);

$mission_retrieve= " SELECT * FROM vmc where vmc_categry='mission' ORDER BY vmc_id DESC LIMIT 1";
$mission_display=mysqli_query($db,$mission_retrieve);

$core1_retrieve= " SELECT * FROM vmc where vmc_categry='core value resilience' ORDER BY vmc_id DESC LIMIT 1";
$core1_display=mysqli_query($db,$core1_retrieve);

$core2_retrieve= " SELECT * FROM vmc where vmc_categry='core value resilience' ORDER BY vmc_id DESC LIMIT 1";
$core2_display=mysqli_query($db,$core2_retrieve);

$core3_retrieve= " SELECT * FROM vmc where vmc_categry='core value resilience' ORDER BY vmc_id DESC LIMIT 1";
$core3_display=mysqli_query($db,$core3_retrieve);

$core4_retrieve= " SELECT * FROM vmc where vmc_categry='core value resilience' ORDER BY vmc_id DESC LIMIT 1";
$core4_display=mysqli_query($db,$core4_retrieve);


?>