I'm using a form to submit data and store it as JSON in a file. No I want to add a new line of info called 'age', and have PHP incrementing it as data is stored... first form submit would have 'age':0, 2nd would have 'age':1 and so on.
$age = 0;
$formdata = array(
'job'=> $_POST['job'],
'company'=> $_POST['company'],
'city'=> $_POST['city'],
'category'=> $_POST['category'],
'type'=> $_POST['type'],
'description'=> $_POST['description'],
'age'=> $age++
);
I have this above, but it keeps storing data as 'age':0, no incrementing. How should I fix it?