Question: I'm calling this line in my browser:

```
example.com/save.php?params={"objID":"i8O0FRuGEr","username":"johndoe","password":123456,"email":"j@doe.com","followedBy":["john","sarah"]}

```

and here's my **save.php** code:

```
<?php 
include 'Config.php';

    $getJSON = $_GET['params'];
    echo 'getJSON: '.$getJSON.'<br><br>';

    $updateArr = json_decode($getJSON, true);
    echo 'UPDATE_ARR: ' .$updateArr; //<-- it prints 'null'...

    $jsonStr = file_get_contents("Users.json");
    // Decode the JSON string into a PHP array.
    $objects = json_decode($jsonStr, true);

    array_push($objects, $updateArr);

    // Encode the array back into a JSON string and save it.
    $jsonData = json_encode($objects);
    file_put_contents("Users.json", $jsonData);

    // echo data
    echo 'JSON DATA: ' .$jsonData;
?>

```

The problem is this code makes my **User.json** file 'null', it removes all objects in it, in fact, the `echo 'UPDATE_ARR: ' .$updateArr;` returns null.
I would need to decode my `$getJSON` string into a PHP array, as I do for my **User.json** file (the `$jsonStr`), but it doesn't work.

What am I doing wrong?

Thanks so much!

Answer: 
You are already using jQuery, so just use

```
$(".reset").on('click', function() {
  $('.input-1').val('');
});

```

Notice the `.` before the class name, same as in `.reset`.

If you want to use vanilla JavaScript, you have to loop through the HTMLCollection returned by `getElementsByClassName`:

```
$(".reset").on('click', function() {
  Array.from(document.getElementsByClassName('input-1')).forEach(el => el.value = '');
});

```

jQuery does that automatically for you.
You can use an special selector for this job:

```
let inputs = [... document.querySelectorAll("[class^='input-']")];

inputs.forEach(i  => i.value = "");

```

class^= will return all the elements containing class attribute starting with "input".