2
I have the following form:
<form method="POST">
Title <input type="text" onchange="Function()">
X <input type="text" onchange="Function()">
Y <input type="text" onchange="Function()">
/* others fields */
</form>
and the test.json file
{
"test":[
{
"title" : "",
"x" : "",
"y" : ""
}
]
}
How do I get an action onchange
inputs and the test.json file be changed and saved automatically to the server?
I’m using PHP, so I’ll put the contents of the JSON file in an array:
$jsondados = file_get_contents("test.json");
$json = json_decode($jsondados,true);
Then I can access the array and put in the variables I want.
I would like suggestions/indications of functions or how to get what is typed in the form to be automatically passed to the php variables.
every time you press a key you will make a submite to the server, that’s it?
– Ricardo
this, but updating the test.json file, or if there is no need for the test.json file another way to update the variable in php according to what is typed in the form
– Gislef
JSON is used as a transport, usually you write the data into a database. Write the JSON itself, only if it is for study or for some very simple application, with little data.
– bfavaretto
are only 3 fields is very simple
– Gislef
I made a simple application that generates image using the GD library, and the text variable, paddind x and y are the ones that must be filled according to the form
– Gislef