I am trying to post php code from my messages table. But it is not posting. For example:
<textarea name="update">User can write php codes here for sending</textarea>
<div class="send">Send</div>
When i click send button the text code <?php echo $message;?> must be in my messages table row post_text . But post_text is empty, you can see it in the screenshot.
What is the problem here. What i shoud do to fix this problem? Anyone can help me here ?
<?php
include_once '../inc/inc.php';
if(isset($_POST['update'])) {
$update=mysqli_real_escape_string($db,$_POST['update']);
if($update){
$data=$DoDo->InsertText($uid,$update);
echo $update;
}
}
?>
InsertText function
public function InsertText($uid, $update) {
$time=time();
$ip=$_SERVER['REMOTE_ADDR'];
mysqli_query($this->db,"SET character_set_client=utf8") or die(mysqli_error($this->db));
mysqli_query($this->db,"SET character_set_connection=utf8") or die(mysqli_error($this->db));
$query = mysqli_query($this->db,"SELECT post_id,post_text FROM `posts` WHERE uid_fk='$uid' order by post_id desc limit 1") or die(mysqli_error($this->db));
$result = mysqli_fetch_array($query, MYSQLI_ASSOC);
$query = mysqli_query($this->db,"INSERT INTO `posts` (post_text, uid_fk,time) VALUES (N'$update', '$uid','$time')") or die(mysqli_error($this->db));
//The newquery to select for message
$newquery = mysqli_query($this->db,"SELECT M.post_id, M.uid_fk, M.post_text, M.time,U.username FROM posts M, users U where M.uid_fk=U.uid and M.uid_fk='$uid' order by M.post_id desc limit 1 ") or die(mysqli_error($this->db));
$result = mysqli_fetch_array($newquery, MYSQLI_ASSOC);
return $result;
}
Note: This problem will be come when i send just php code. If i send normal text then normal text sending from post_text.
I want to send php code like this screenshot.


