Mahbubur Rahman Khan Mahbubur Rahman Khan - 1 year ago 59
AngularJS Question

PHP can't read email address from $http post method of angular

Everything works fine except email address. When i post email address to server and just echo it, recieve nothing. Only problem in @ symbol, rest are ok.


method: 'POST',
url: '',
data: {
signInSubmitBTN: '', email: ''
}).success(function (data) {
alert(data); //alert empty when but is ok


if (isset($_POST['signInSubmitBTN'])) {

$email = $_POST["email"];

echo $email;

NOTE - already configure app

app.config(function ($httpProvider, $httpParamSerializerJQLikeProvider) {
$['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8';

Answer Source

You need to encode using base64:

signInSubmitBTN: '',  email: window.btoa('')

And don't forget to decode on the server side using atob()

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download