[英]PHP MYSQLdisplaying unwanted span tags
I am submitting some text to a MYSQL database using php, however I am getting some unwanted styling with the text. 我正在使用php向MYSQL数据库提交一些文本,但是我得到了一些文本不必要的样式。 I am wanting to basically keep all the text in one paragraph tag and just have breaks to separate the lines.
我想基本上将所有文本保留在一个段落标签中,但要稍作休息以分隔行。 When I look at the text in the database it is included with all the styling tags such as brs', spans' and divs'.
当我查看数据库中的文本时,它包含在所有样式标签中,例如brs,spans和divs。 I want the break tags but not the spans and divs.
我需要break标签,但不需要span和div。 Why would this be happening and how can I prevent the spans and divs from being included with the inserted text.
为什么会发生这种情况,以及如何防止span和div包含在插入的文本中。 I will provide my code below.
我将在下面提供我的代码。
here is the php update code 这是PHP更新代码
if($_POST['about']){
$edit_desciption = $_POST['about'];
$id = 1;
$stmt = $conn->prepare('UPDATE table_name SET about = ? WHERE id = ?');
$stmt->bind_param("si", $edit_desciption, $id);
$stmt->execute();
// echo $final_outputs;
$stmt->close();
$conn->close();
header("Location: ../../admin_login/logged_in.php");
//$connect->close();
}
and here is the form 这是表格
function getContent(){
document.getElementById("about").value = document.getElementById("about_edit").innerHTML;
}
<p id="about_edit" contentEditable="true"><?php echo $output; ?></p>
<div class="col-12">
<form id="update_CMS" onsubmit="return getContent()" action="../includes/php/edit.php" Method="POST">
<textarea id="about" name="about" style="display: none;"></textarea>
<input type="submit" name="submit" id="edit_submit" />
</form>
</div>
Using: 使用:
strip_tags($_POST['about'], '<br><p>')
works 作品
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.