Note that there are some explanatory texts on larger screens.

plurals
  1. PORemove HTML tags in textaera (Basic CMS)
    primarykey
    data
    text
    <p>I am very new to PHP and started making a light weight CMS. I have stored all the body content in the database and the CMS calls it from the database and displays it in a text area to be edited. However I was wondering is there a way to make it display the text without HTML tags. I have tried the <code>strip_tag</code> function however when I hit save on my cms it saves without the html tags! how will I go about making it display the data from the database without HTML tags but when I save it, it will save with the HTML tags! Sorry if this question is not clear but it is quite difficult to explain. Here is my code so far working fine:</p> <pre><code>&lt;?php include_once "includes/scripts.php"; ?&gt; &lt;?php include_once "includes/connect.php";?&gt; &lt;?php include_once "includes/cms_page_security.php";?&gt; &lt;?php $sql = "SELECT * FROM content WHERE id = '5'"; $result = mysql_query($sql, $connect); $num= mysql_numrows($result);mysql_close(); $row = mysql_fetch_row($result); $pg_content = $row['1']; if (isset($_POST['saveChanges'])){ $pgcontent = $_POST['edit']; $sql_query = ("UPDATE content SET cage_content= '$pgcontent' WHERE cage_content= '$pg_content'"); mysql_query($sql_query,$connect); header('location: admin_cms_staff.php'); $feedback = "Updated successfully"; } ?&gt; &lt;div id="cms_container"&gt;&lt;br&gt; &lt;h1&gt;Staff Page&lt;img src="images/three_column_grid_line.png" alt="line"&gt;&lt;/h1&gt; &lt;form id="form1" name="form1" method="post"&gt; &lt;textarea id="content" name="edit"&gt;&lt;?php echo $pg_content; ?&gt;&lt;/textarea&gt; &lt;input type="submit" class="submit_edit" value="Save" name="saveChanges" onClick="alertFunction()"&gt; &lt;/form&gt; &lt;p class="logout_btn"&gt;&lt;a href="admin_cms.php"&gt;Back&lt;/a&gt;&lt;/p&gt; &lt;?php if(isset($_POST['saveChanges'])){ echo $feedback;}?&gt; &lt;/div&gt;&lt;!--cms_container--&gt; &lt;script&gt; function alertFunction() { var r=confirm("Do you want to save the changes you made to the page?"); if (r==true) { } else { return; } } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload