Saving Data from form to database using AngularJS and php Saving Data from form to database using AngularJS and php database database

Saving Data from form to database using AngularJS and php


first you should be able to create a db in mysql and creat a table for that .
then you should be able to connect them with php like this :

    $host = "localhost";$user = "angular";$pass = "angular";$database = "angular";$con = mysql_connect($host,$user,$pass);if (!$con) {    die('Could not connect: ' . mysql_error());}echo 'Connected successfully';mysql_select_db($database,$con);


With limited information you provided, i will try to help you on this. When you ask questions, please show what output your are getting, what your debugging says. It will be helpful for others to understand your problem and suggest you some solution. Here is my suggestions

1) I could not see scope of your $http.post("insert.php", **data**) data variable make sure that you have serialized data in it.

2) Check in firebug whether your request is being sent or not. If you can see the request then see what is the response you are getting

3) As you have success handler always have a error handler for any Ajax call, it is a best practice and saves lot of your time in debugging

My suggestions are based on assumption that your insert.php is tested for inserting data properly. If not you have to follow what John Conde told