javascript – PHP not sending formatted text from ckeditor-ThrowExceptions

Exception or error:

I have ckeditor embedded into my php form but when I hit send, it doesn’t the query in the intended format rather it shows raw html tags such as instead of showing bold text, it shows abc or with tags.

This form previously on had a small field that allowed basic non-formatted text to be sent. I’m trying to make ckeditor work so that the users can not only send the text but also add their desired formatting and media files as well. The form is very simple as I’ve not worked with php before, I don’t know what it is that I’m doing wrong. ckeditor is passing on the formatting info onto php but rather than send the formatted data, the form is sending only the raw html data.

I don’t know whether it’s a permissions issue or if the php form needs a few more lines of code added to make it work the way I want.

Thank you so much.

My php form code is:

<?php
session_start();
if ($_POST['Submit'] == 'Send')
{
if (strcmp(md5($_POST['user_code']),$_SESSION['ckey']))
    { 
header("Location: sendquery.php?msg=ERROR: Invalid Verification Code");
exit();
  } 

$subject = $_POST['subject'];
$editor1 = $_POST['editor1'];
$fromname = $_POST['fromname'];
$lt= '<';
$gt= '>';
$sp= ' ';
$from= 'From:';
$headers = $from.$fromname.$sp.$lt.$gt;
mail($subject,$editor1,$headers);
header("Location: sendqueryl.php?msg= Query Sent!");
exit();
}
?>
<html lang="en">
<head>
<meta charset="utf-8">
<script type="text/javascript" src="source/ckeditor/ckeditor.js"></script>
</head>
<body bgcolor="#ffffcc">
<p style="margin-left:15px">
<form action="sendquery.php" method="POST">
<b>From Name:</b><br>
<input type="text" name="fromname" size="50"><br>
<input type="text" name="subject" size="74"><br>
<br><b>Your Message:</b><br>
<textarea name="editor1" id="editor1" rows="10" cols="80">
</textarea>
<script>
CKEDITOR.replace( 'editor1' );
</script>
<br>
<br><b>Verification Code:</b><br>
<input name="user_code" type="text" size="25">  
<img src="pngimg.php" align="middle"><br><br>
<input type="submit" name="Submit" value="Send">
<input type="reset" value="Reset">
</form>
</p>
<?php if (isset($_GET['msg'])) { echo "<font color=\"red\"><h3 align=\"center\"> $_GET[msg] </h3></font>"; } ?>
</body>
</html>

<?php

?>


How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *