如何从CKEDITOR通过$ _POST获取数据?

时间:2013-12-13 10:16:51

标签: php ckeditor

如何从CKEDITOR通过$ _POST获取数据?我正在做CKEDITOR,我可以在将数据发布到action.php之前创建自己的HTML /纯文本电子邮件,在那里它会向相应的用户发送电子邮件。

   <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 = "xxx@gmail.com, xxxx@gmail.com";
$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: <webmaster@example.com>' . "\r\n";
$headers .= 'Cc: myboss@example.com' . "\r\n";

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

1 个答案:

答案 0 :(得分:6)

<强>尝试

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

希望你想要