I am using $http.post() method to send data to php->then databse, but $http.post is working successfully on localhost but not working on live server...
But $http.get() is working properly on live server as well as localhost. I am able to full data from data using $http.get().
Could someone please help me on this?
POST Method code: Angular
$scope.registerUser = function(){
if($scope.terms == true){
**$http.post('../../dcr/php/registration.php',**
{
'regUserName' : $scope.regUserName,
'regDisplayName': $scope.regDisplayName,
'uType':$scope.uType,
'regPassword':$scope.regPassword,
'regUserEmail':$scope.regUserEmail,
'gender':$scope.gender,
'regMobile' : $scope.regMobile,
'regUserAltEmail':$scope.regUserAltEmail,
'regPhotoID':$scope.regPhotoID,
'regPhotoIDno':$scope.regPhotoIDno,
'regDesignation' : $scope.regDesignation
}).success(function(data,status,header,config){
console.log("inside success");
}).error(function(data,status,header,config,error){
console.log("error");
});
PHP code:
<?php
require 'connection.php';
header('Content-Type: application/json');
$data = json_decode(file_get_contents("php://input"),true);
$regDisplayName = mysql_real_escape_string($data['regDisplayName']);
$regUserName= mysql_real_escape_string($data['regUserName']);
$regPassword= mysql_real_escape_string($data['regPassword']);
$regUserEmail= mysql_real_escape_string($data['regUserEmail']);
$gender= mysql_real_escape_string($data['gender']);
$uType= mysql_real_escape_string($data['uType']);
$regMobile = mysql_real_escape_string($data['regMobile']);
$regUserAltEmail = mysql_real_escape_string($data['regUserAltEmail']);
$regPhotoID = mysql_real_escape_string($data['regPhotoID']);
$regPhotoIDno = mysql_real_escape_string($data['regPhotoIDno']);
$regDesignation = mysql_real_escape_string($data['regDesignation']);
$sql = "INSERT INTO employee (`name`, `uname`, `mobile`, `password`, `email`, `userType`,`gender`,`AlternateEmail`,`PhotoIDProof`,`PhotoIDno`,`designation`)
VALUES ('$regDisplayName', '$regUserName', '$regMobile','$regPassword', '$regUserEmail', '$uType','$gender','$regUserAltEmail','$regPhotoID','$regPhotoIDno','$regDesignation')";
mysqli_query($db,$sql) or die(mysql_error());
?>
Kuldeep I researched the error, and as @Script47 said, and as the screenshot suggest, it an internal server error. You mentioned that you are using godaddy as your web host. I think the problem could be a misconfigured or corrupted .htaccess file, so you need to check that.
I have this link you could check to get more info: Why am I getting a 500 Internal Server Error Message?