I am trying to convert post data into a format that would allow me to pass it right into my collection. For example: When I print_r on the $_POST I get this form data:
Array
(
[Name] => Steve
[Email] => [email protected]
[submit] => Submit
)
I am wondering how i can convert this to an acceptable object to insert into mongodb collection using php similar to:
$Record = array(
'Name' => 'Steve',
'Email' => '[email protected]',
'submit' => 'Submit'
);
$Collection->insert($Record);
I am thinking a loop of the above array with some additional formatting but I can't seem to figure it out. I have also tried json_encode but keep getting the same error "Call to a member function insert() on a non-object in..." saying that its not a proper object. Thank you for any help.