%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/eirtvhdf/hire-va.com/virtual-assistant-offer/
Upload File :
Create Path :
Current File : //home/eirtvhdf/hire-va.com/virtual-assistant-offer/insert.php

<?php

$dbh=mysqli_connect ('localhost', 'eirtvhdf_hire-va-offer', 'HireVA!123@','eirtvhdf_hire_va_offer');
session_start();

extract($_POST);


// $category = $_POST['category'];
// $job_role = $_POST['job_role'];
// $job_type = $_POST['job_type'];
// $p_time = $_POST['p_time'];
// $f_time = $_POST['f_time'];
// $emp = $_POST['emp'];



    

    if(isset($_POST['category'])){
        
     if(!empty($p_time)){
         $hour = $p_time;
         $cost = 3*$hour*$emp;
     }
     else{
         $hour = $f_time;
         $cost = 5*$hour*$emp;
     }
    
     if($hour < "8"){
         $job_type="Part Time";
     }
    else{
         $job_type="Full Time";
     }

    if(!empty($_SESSION['va_ID'])){
        $auto_id = $_SESSION['va_ID'];
    }
    else{
        $auto = rand(10,1000);
    $_SESSION['va_ID'] = "va_".$auto;
    $auto_id = $_SESSION['va_ID'];
    }
    
    mysqli_query($dbh,"insert into virtual_assistant values('','$auto_id','$category','$job_role','$job_type','$hour','$emp','$cost')");
    // mysqli_query($dbh,"insert into va_live values('$auto_id','$category','$job_role','$job_type','$hour','$emp')");
    }
    
    
    if(isset($_POST['readrecord'])){
        session_start();
        $auto_id = $_SESSION['va_ID'];
    $data = '<table class="table table-bordered table-striped">
                <tr> 
                <th>S.No</th>
                <th>Category</th>
                <th>Job Role</th>
                <th>Job Type</th>
                <th>Number of Hours/Employee</th>
                <th>Number of Employee</th>
                <th></th>
                </tr>';
                
        $displayquery = "select * from virtual_assistant where va_id='$auto_id'";
        $result = mysqli_query($dbh,$displayquery);
        
        if(mysqli_num_rows($result)  > 0){
            $number = 1;
            while($row = mysqli_fetch_array($result)){
                $data .= '<tr>
                <td>'.$number.'</td>
                <td>'.$row['category'].'</td>
                <td>'.$row['job_role'].'</td>
                <td>'.$row['job_type'].'</td>
                <td>'.$row['no_of_hours'].'</td>
                <td>'.$row['no_of_emp'].'</td>
                <td>
                <button onclick="DeleteUser('.$row['id'].')" class="btn btn-danger">Delete</button>
                </td>
                </tr>';
                $number++;
            }
            
            
        }
        $data .= '</table>';
        echo $data;
}

    
    
    if(isset($_POST['deleteid'])){
        $userid = $_POST['deleteid'];
        $daletequery = "delete from virtual_assistant where id='$userid'";
        mysqli_query($dbh,$daletequery);
    }
    

?>

Zerion Mini Shell 1.0