Controller for sign-up
.controller('signupCtrl',
function($scope,$http,$ionicPopup,$state,$ionicHistory) {
$scope.signup=function(data){
var link = 'http://localhost/b_data/server/signup.php';
$http.post(link, {n : data.name, un : data.username, ps : data.password , ph: data.phone , add : data.address , pin : data.pincode })
.then(function (res){
$scope.response = res.data.result;
if($scope.response.created=="1"){
$scope.title="Account Created!";
$scope.template="Your account has been successfully created!";
//no back option
$ionicHistory.nextViewOptions({
disableAnimate: true,
disableBack: true
});
$state.go('login', {}, {location: "replace", reload: true});
}else if($scope.response.exists=="1"){
$scope.title="Email Already exists";
$scope.template="Please click forgot password if necessary";
}else{
$scope.title="Failed";
$scope.template="Contact Our Technical Team";
}
var alertPopup = $ionicPopup.alert({
title: $scope.title,
template: $scope.template
});
});
}
})
Backend signup.php few lines
if(isset($_GET["n"]) && isset($_GET["un"])&& isset($_GET["ps"])&& isset($_GET["ph"])&& isset($_GET["add"])&& isset($_GET["pin"]) ) {
if( !empty($_GET["n"]) && !empty($_GET["un"])&& !empty($_GET["ps"])&& !empty($_GET["ph"])&& !empty($_GET["add"])&& !empty($_GET["pin"]) ){
//rest of my db saving code
} }
As per debugging there is no issue i found in angular as well as php code, when debugging i found in php $_GET['n'] is not working so the rest of get codes.
Sort this out.