mercredi 29 avril 2015

Load and update a locally JSON file by input text

I'm working on a project with a little CMS system where data gets loaded from a extern JSON file.

This data loads in perfectly, but then I'm trying to update the JSON with HTML input fields (like changing a title and stuff)

A little preview of the JSON File:

"paths": [{
    "path": [{

This is the code that I have for the loading in:

$string = "file.json";
$jsonString = file_get_contents($string);
$data = json_decode($jsonString, true);
$paths = $data["paths"];

And then there are some input fields like this:

<input type="text" name="title" value="Update the title" />

So I just want to update some textfields and overwrite the JSON titles for example. Hope someone can help me.

PS: I know that SQL maybe was a better solution, but I received this from the client.

Aucun commentaire:

Enregistrer un commentaire