user3036527
user3036527

Reputation: 75

How do i fetch data via $_POST from CKEDITOR?

how do i fetch data via $_POST from CKEDITOR? I am doing a CKEDITOR where i can create my own HTML/plain text email before posting the data to action.php where it will send an email to the respective user.

   <form method="POST" action="action.php" name="form" id="form">       
          <table border="0">
<tr>

    <td>    <input type="text" name="subject" placeholder="Subject" size="50"> 

  </td>
  </tr>
  <tr>

    <td><textarea id="editor1" name="editor1" rows="10" cols="80">
                This is my textarea to be replaced with CKEditor.
            </textarea> 
            <script>
                // Replace the <textarea id="editor1"> with a CKEditor
                // instance, using default configuration.
                CKEDITOR.replace( 'editor1' ); 
            </script>  
    </td>
  </tr>
  <tr>              
    <td><input type="submit" class="btn btn-success" value="Submit" name="submit"></td></form>

  </tr>
</table>   

action.php

<?php
$to = "[email protected], [email protected]";
$subject = "HTML email";

$message = '
HOW??? CK EDITOR FETCHED DATA HERE VIA $_POST
';

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

// More headers
$headers .= 'From: <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";

mail($to,$subject,$message,$headers);
?>

Upvotes: 4

Views: 12433

Answers (1)

sergio
sergio

Reputation: 5260

Try

$message =  htmlentities($_POST['editor1']);

hope it that you want

Upvotes: 7

Related Questions