Hello , Today now in this post I want to share with you because when i was working on native PHP and with Ajax Post request(Specially AngularJS Post request) at that time i can’t get the Post value on form submit. So on that’s why i would like to share with you this post. I also want to tell you what i was working on my Ubuntu 14.04.So I did try lot but i can’t get value.
So at last find stuff to how to solve this issue, i did use “file_get_contents(‘php://input’)” so that way i could get POST value in json object and now i also can decode json value by using “json_decode()”.
So let’s try this way :
Example:
$post = file_get_contents('php://input');
$post = json_decode($post);
$sql = "INSERT INTO items (title) VALUES ('".$post->title."')";
$result = $mysqli->query($sql);
Read Also : How to Create Custom Blade Directive in Laravel?
Thanks for read. I hope it help you. For more you can follow us on facebook.