ok

Mini Shell

Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/old/
Upload File :
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/old/event-add.php

<?php  include "header.php";?>

<?php
if(isset($_POST['add_event'])){
        try{
            $events_name="";
            $role="";
            $image="";
            $achiver_name="";
            $achiver_department="";
            $achiver_rank="";
            
        if(isset($_POST['event_name'])){
             $events_name = $_POST['event_name'];
        }
        if(isset($_POST['status'])){
             $role= $_POST['status'];
        }
       

        if(isset($_POST['achiver_name'])){
             $achiver_name= $_POST['achiver_name'];
        }
        if(isset($_POST['department_name'])){
             $achiver_department= $_POST['department_name'];
        }
        if(isset($_POST['achiver_rank'])){
             $achiver_rank= $_POST['achiver_rank'];
        }



        $date =  date("Y-m-d");
        if(isset($_FILES['achiver_image']) && $_FILES["achiver_image"]["name"]!=""){
            $file_name = $_FILES['achiver_image']['name'];
            $tmp = explode('.', $file_name);
            $extension = end($tmp);
            $extension = end(explode(".", $_FILES["achiver_image"]["name"]));
            $image = rand(10,1000000000)."-".$date."-org_signature." . $extension;
            $upload = move_uploaded_file($_FILES['achiver_image']['tmp_name'], '../upload/achivers/' . $image);
            $image = 'upload/achivers/' . $image;
                    }
            if(isset($_FILES['placement_image']) && $_FILES["placement_image"]["name"]!=""){
            $file_name = $_FILES['placement_image']['name'];
            $tmp = explode('.', $file_name);
            $extension = end($tmp);
            $extension = end(explode(".", $_FILES["placement_image"]["name"]));
            $image = rand(10,1000000000)."-".$date."-org_signature." . $extension;
            $upload = move_uploaded_file($_FILES['placement_image']['tmp_name'], '../upload/placement/' . $image);
            $image = 'upload/placement/' . $image;
                    }
                    $statement = $pdo->prepare("INSERT INTO `tbl_event`(`event_name`,`role`,`image`,`achiver_name`,`achiver_department`,`achiver_rank`)
                    VALUES ('$events_name','$role','$image','$achiver_name','$achiver_department','$achiver_rank')");
                  
                   	$result = $statement->execute();

                   
                    if($result){
                     echo  '<script type="text/javascript">
                        alert("New Events Added successfully");
                        window.location.href = "event-details.php";
                        </script>';
                        unset($_POST);      
                    }else{
                      echo  '<script type="text/javascript">
                        alert("Something went wrong try again...");
                        </script>';
                    }  
                }catch(Exception $e){
                    $error=$e;
                }   
    }
?>

<div class="content-wrapper" style="background:white;">
        <div class="clearfix"></div>

<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div>
                <div class="box-header">
                    <h3 class="box-title"><b>Add New Events Image: </b></h3>
                </div>
                <div class="box-body">
                    <div class="col-lg-12">
<!--<div id="loading-div">
<center><img src="assets/load.gif" style="10%"><br>
<strong class="blink_me">Loading Pls Wait... </strong></center>
</div>
<div id="success-div">
</div>-->
<div id="content-div">
                        <form action="" enctype="multipart/form-data" method="post" accept-charset="utf-8">
                            <div class="row">
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="required" for="status">Select Events</label>                                    
                                    <select name="status" id="status" class="form-control tip select2">
                                        <option>Select Any One</option>
                                        <option value="1">Announcement</option>
                                        <option value="2">News And Events</option>
                                        <option value="3">Achivers</option>
                                        <option value="4">Placement News</option>
                                    </select>
                                </div>
                            </div>
                            <div id="special_trip_date">
                               
                            </div>
                           
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="required" for="file">Action</label><br>
                                    <input type="submit" id="add_category" name="add_event" value="Add Event"  class="btn btn-success" />
                                </div>
                            </div>
 
                             
                             
                        </div>
                        </form>
</div>



<div class="form-group" style="text-align:center;">
    <a href="gallery-add.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a>
    <a href="gallery.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a>
 </div>
                    
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</section>

    <script>
$(document).ready(function(){
    trip_status();
});


$("#status").change(function () {
    trip_status();
});


function trip_status(){
    var trip_status = $("#status").val();
        $("#special_trip_date").empty();
       /* Trip Status ( 1=Always ON, 2=Special Trip ON, 3=Trip Off )*/
        var anouncement ='<div class="col-md-4"><div class="form-group"><label class="required" for="file">Announcement</label><input type="text" name="event_name"  id="photo" value="" placeholder="Enter Anouncement Content" class="form-control tip" required="required" /><span style="color: red;" id="photospan"></span></div></div>';
        var news ='<div class="col-md-4"><div class="form-group"><label class="required" for="file">News & Events</label><input type="text" name="event_name"  id="photo" value="" placeholder="Enter News & events Content" class="form-control tip" required="required" /><span style="color: red;" id="photospan"></span></div></div>';
        var achiver ='<div class="col-md-4"><div class="form-group"><label class="required" for="file">Achivers name</label><input type="text" name="achiver_name"  id="photo" value="" placeholder="Enter Achivers name" class="form-control tip" required="required" /><span style="color: red;" id="photospan"></span></div></div><div class="col-md-4"><div class="form-group"><label class="required" for="file">Achivers Photo</label><input type="file" name="achiver_image"  id="photo" value="" placeholder="Enter Achivers image" class="form-control tip" required="required" /><span style="color: red;" id="photospan"></span></div></div><div class="col-md-4"><div class="form-group"><label class="required" for="file">Achivers Department Name</label><input type="text" name="department_name"  id="photo" value="" placeholder="Enter Achivers Department Name" class="form-control tip" required="required" /><span style="color: red;" id="photospan"></span></div></div><div class="col-md-4"><div class="form-group"><label class="required" for="file">Achivers Rank</label><input type="text" name="achiver_rank"  id="photo" value="" placeholder="Enter Achivers Rank" class="form-control tip" required="required" /><span style="color: red;" id="photospan"></span></div></div>';
        var placement ='<div class="col-md-4"><div class="form-group"><label class="required" for="file">Placements Photo</label><input type="file" name="placement_image"  id="photo" value="" placeholder="Enter News & events Content" class="form-control tip" required="required" /><span style="color: red;" id="photospan"></span></div></div>';

        if(trip_status==1){
            $("#special_trip_date").append(anouncement);
        }else if(trip_status==2){
            $("#special_trip_date").append(news);
        }else if(trip_status==3){
            $("#special_trip_date").append(achiver);
        }else if(trip_status==4){
            $("#special_trip_date").append(placement);
        }
        
        else{
            
        }
}
</script>


<style>
    table,td,th{
        padding:5px;
    }
    th{
        border: 1px solid black;
    }
    td{
        border: 1px solid black;
        border-style: dashed;
    }
</style>
<?php include "footer.php";?>

Zerion Mini Shell 1.0