I currently have a basic form setup with a controller, and when the user submits the form, this function is ran:
$scope.create = function(email, username, password) {
MyService.get({
action: 'create',
email: email,
username: username,
password: password
}, function(data) {
// Success callback
});
};
The problem is that if the user submits the form with an empty field, the php receiving this request throws an undefined index error for that field.
Ex: User doesn't fill in email and presses submit. The php throws an error because $_GET['email'] is an undefined index.
How can I get it so that the resource just sends an empty value if the field is empty? (I'd prefer this to adding array_key_exists checks or the likes for everything in the php)