how to create an wysiwyg html editor in <textarea name="sender_message"></textarea> is it possible when send an email from a php form?

Recommended Answers

All 4 Replies

Can you give a little more detail?

I'm not sure if you're wanting to fill in an HTML email with data from a form, or use a field in a form to create an HTML document, or use some kind of drag and drop HTML editor.

You could do something like:

<!-- put your own header stuff above this line, use your imagination -->
if (isset($_POST['submit']))
 echo $_POST['sender_message'];
if (isset($_POST['post']))
 // put your email code here.
<hr /><hr />
<form action='thisfile.php' method='post'>
<textarea name="sender_message">$message</textarea>
<input type='submit' name='submit' value="View" />
<input type='submit' name='post' value="Post Email" />

I don't know, anyone else have a better solution?


Oops, I forgot a major part of that.

In order to send HTML as email you have to put some additional info in your email headers.

$headers = "From: \r\n";  // replace with your email address
  $headers .= "Reply-To: \r\n";
  $headers .= "MIME-Version: 1.0 \r\n";
  $headers .= "Content-Type: text/html; charset=ISO-8859-1 \r\n";
  $emailto = "";            // replace with the addressee
  $subject = "Subject of email";                   // replace with the subject line



<textarea name="sender_message">$message</textarea>


<textarea name="sender_message"><?php echo $message; ?></textarea>

thanks David its help me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.