I am working with Reactjs and i am using Nextjs,I am trying to Post data with axios But Data is inserting "NULL" values,Where i am wrong ? Here is my code in nextjs
const userData = {
name: state.name,
job: state.job
};
axios.post("https://diggdevelopment.com/openc/api/testinfo", userData).then((response) => {
alert(response);
});
Here is my code in php
$_POST = json_decode(file_get_contents("php://input"),true);
$name=$_POST['name'];
$job=$_POST['job'];
$data = array(
'name'=>$name,
'job'=>$job
);
$this->db->insert('test',$data);
let response = await axios.post("https://diggdevelopment.com/openc/api/testinfo", userData);thenalert(response);