1

I have an http post operation in javascript side lie this:

app.controller("ContactController", ["$scope","$http", 
    function($scope, $http){

        $scope.sendForm = function(){
            var httpOptions = {
                url: "contact.php",
                method: "POST",
                data: {
                    name: $scope.name,
                    email: $scope.email,
                    message: $scope.message,
                    website: $scope.website
                }
            };

            $http(httpOptions).success(onRequestSuccess).error(onRequestError);
        }

And my PHP content like this:

<?php

    $name = isset($_POST['name']) && $_POST['name'] ? $_POST['name'] : '';
    $email = isset($_POST['email']) && $_POST['email'] ? $_POST['email'] : ''; 
    $message = isset($_POST['message']) && $_POST['message'] ? $_POST['message'] : '';
    $website = isset($_POST['website']) && $_POST['website'] ? $_POST['website'] : ''; 

    if($name && $email && $message)
    {
      echo "success"
    }else echo "error";

The php code writes error

infused
  • 24,000
  • 13
  • 68
  • 78
barteloma
  • 6,403
  • 14
  • 79
  • 173
  • how about a `var_dump` of `$_POST`? Are any of your variables making it to the server? What does your view look like? are each of those scope properties bound to an input somewhere (or otherwise getting set?) – Jeff Lambert Jul 29 '14 at 19:55

0 Answers0