How do i fetch data via $_POST from CKEDITOR?

10,595

Try

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

hope it that you want

Share:
10,595

Related videos on Youtube

user3036527
Author by

user3036527

Updated on September 15, 2022

Comments

  • user3036527
    user3036527 over 1 year

    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);
    ?>
    
  • user3036527
    user3036527 over 10 years
    THANK YOU! IT WORKED! I love from the bottom of my heart~ Note: there is no need for htmlentities as HTML email will not be able to display correctly
  • user3036527
    user3036527 over 10 years
    15 rep required! sorry!