好傢伙, 我'新在PHP中加入一些新的東西,我需要幫助如何添加簡單的編輯對我的評論框
添加簡單的編輯爲我添加評論框?
謝謝我希望我能在這裏得到幫助。 謝謝我希望我能在這裏得到幫助。
這樣 enter image description here
<!-- Start Add Comment -->
<?php
if (isset($_SESSION['user'])) {
$stopitem = $con->prepare("SELECT opitem FROM items");
// Execute The Statement
$stopitem->execute();
// Assign To Variable
$opitem = $stopitem->fetch();
if ($opitem['opitem'] == 0) {
?>
<div class="row">
<div class="col-md-offset-1">
<div class="add-comment">
<h3>
Add Your Comment
</h3>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'] . '?itemid=' . $item['Item_ID'] ?>">
<textarea name="comment" required="required"></textarea>
<input class="btn btn-primary" type="submit" value="Add Comment" name="">
</form>
<?PHP
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$comment = filter_var($_POST['comment'], FILTER_SANITIZE_STRING);
$userid = $item['Member_ID'];
$itemid = $item['Item_ID'];
if (!empty($comment)) {
$stmt = $con->prepare("INSERT INTO comments(comment, status, comment_date, item_id, user_id) VALUE(:zcomment, 0, NOW(), :zitemid, :zuserid)");
$stmt->execute(array(
'zcomment' => $comment,
'zitemid' => $itemid,
'zuserid' => $userid
));
if ($stmt) {
echo "Comment Added";
}
} else {
echo '<div class="alert alert-danger">You Must Add Comment</div>';
echo '<script language="javascript">';
echo 'alert("You Must Add Comment")';
echo '</script>';
}
}
?>
</div>
</div>
</div>
<?php
} else {
echo "This Item is closed.";
}
} else {
echo '<a href="login.php">Regester</a> or <a href="login.php">Log In</a> To Add Comment';
}
?>
<!-- End Add Comment -->
可以使用CKEditor的http://ckeditor.com/ –
請選擇答案,因爲接受,如果它是對您有所幫助。 –
如何在評論框中安裝? –