How to save html and text in the database?

  1. Just use the wpdb insert and update API, no escaping or sanitizing needed as per the doc, just the raw data.

Data: (array) Data to replace (in column => value pairs). Both $data columns
and $data values should be “raw” (neither should be SQL escaped).

Something like:

    $wpdb->insert(
      $wpdb->prefix . "myTable",
      array(
        "doiBody" => $_POST['doi-body']
      ),
      array( "%s" )
    );
  1. No wpautop use is needed if you are outputting into the wp_editor textarea, just an esc_attr( $output ) would be sufficient I believe.

Hope this helps somehow.