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

4

我该如何通过 $_POST 从 CKEDITOR 中提取数据?我正在使用 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个回答

7

尝试

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

hope it that you want


谢谢!它生效了!我由衷地喜欢它~ - user3036527
15 rep required! sorry! - user3036527

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接