I'm using PHP to take the inputs of an HTML form and add them to a JSON file like so:
$file = ('inputs');
$array = array(
'First Name' => $firstname,
'Last Name' => $lastname,
'Email' => $email,
);
It worked initially but when I added multiple sets of data I was getting an "expected end of document" error in VS Code because I had to put [] tags around the data sets which are enclosed in {} tags.
// Example of JSON Data
[
{
"First Name": "James",
"Last Name": "Smith",
"Email": "[email protected]",
}
]
When I add more data it adds the {} data outside of the [] tags and I have no idea how to fix it so that it goes within the [] tags, so I'm hoping someone here has some tips to help me out.