hi richard thanks for your reply ?? but i am still not understand what to do ,this code is used for fetch the data but i want to save the data but how ? I will show you our code what i am doing :
i am using under the rest api plugin this is my url:
URL:
‘/posts/newsletters’ => array(
array( array( $this, ‘newsletters’ ), WP_JSON_Server::CREATABLE | WP_JSON_Server::ACCEPT_JSON ),
),
FUNCTION :
public function newsletters(){
$newsletter = new Ninja_Forms();
$response = new WP_JSON_Response();
$data1 = array();
$data[‘ninja_forms_field_1’] = $_POST[‘name’];
$data[‘ninja_forms_field_2′] = $_POST[’email’];
$data[‘ninja_forms_field_3’] = $_POST[‘message’];
$name=$data[‘ninja_forms_field_1’];
$email=$data[‘ninja_forms_field_2’];
$message=$data[‘ninja_forms_field_3’];
print($message);
print($email);
print($name);
it will show all the rest my mail , name and message but how i save into the database can you please give some idea or code to save this data . thanks