<?php
    //get index
    $index = $_GET['index'];
 
    //fetch data from json
    $data = file_get_contents('api/RTXPlalist.json');
    $data = json_decode($data, true);
 
    //delete the row with the index
     unset($data['rows'][$index]);
 
    //re-index the array
    $data['rows'] = array_values($data['rows']);
 
    //encode back to json
    $data = json_encode($data, JSON_PRETTY_PRINT);
    file_put_contents('api/RTXPlalist.json', $data);
 
    header('location: index.php');
?>
