I must admit I am a little bit confused... I have never done this before and I am apparently missing something
When I pass data via http.post to my php file I am can't seem to collect data...
Can someone tell me why this does not work?
FormData gets displayed in console log,, and the file is being written for sure.. however it looks like no data is passed..
$scope.submitForm = function() {
formData = $scope.form;
$http.post('form2.php', JSON.stringify(formData)).success(function(){
console.log(formData);
//window.location.href = "form2.php?data=" + JSON.stringify(formData);
});
};
This is in my php file.. trying to write data from submitted form to a file... (just testing)..
<?php
$file = 'form2.txt';
$data = json_decode($_REQUEST['data'],true);
//print( '<pre>' );
//print_r ($data);
//print( '</pre>' );
$data_insert = "Name: " . $data['firstname'] .
", Email: " . $data['emailaddress'] .
", Description: " . $data['textareacontent'] .
", Gender: " . $data['gender'] .
", Is Member: " . $data['member'];
//print $data_insert;
file_put_contents($file, $data_insert, FILE_APPEND | LOCK_EX);
?>