<?php
session_start();

// Get the incoming JSON data
$data = json_decode(file_get_contents('php://input'), true);

// Store selectedStatus in session
if (isset($data['selectedStatus'])) {
    $_SESSION['selectedStatus'] = $data['selectedStatus'];
    $_SESSION['selectedStatusnew'] = $data['selectedStatus'];
    echo json_encode(['status' => 'success', 'message' => 'Selected status stored in session']);
} 
else if (isset($data['selecteddelStatus'])) {
    $_SESSION['selecteddelStatus'] = $data['selecteddelStatus'];
    echo json_encode(['status' => 'success', 'message' => 'Delete lead status stored in session']);
}else {
    echo json_encode(['status' => 'error', 'message' => 'No selectedStatus provided']);
}
?>
