Jump to content

Code in Pre Tags Cuts Off


glassfish

Recommended Posts

This is my code:

 

The Form:

<div class="tcn02">
    
    <H1>You are Writing this Post</H1>
    
    <form action="insert.php" method="POST">

        <input class="input_title" type="text" name="title" />
        <br />

        <textarea id="editor1" type="text" name="post"></textarea>
        <br />
        <input type="submit" name="submit" />
    </form>
</div>

The Query:

<?php

$title = $_POST['title'];
$post = $_POST['post'];

echo "<div class='tcn02'>";

# The Query String
$tqs = "INSERT INTO ttn02 (title, post, date_created) VALUES ('$title', '$post', now())";

# The Query Run
$tqr = mysqli_query($dbc, $tqs) or die(mysqli_error($dbc));


echo "The data has gotten successfully added.";
echo "</div>";

?>

When I try to store code which I am looking to print inside pre tags, then the code gets cut off.

 

I have tried to store the form from above into the database.

 

Each time it gets cut off like shown in the example

 

This is how it gets stored into the database:

<p>The Code:</p>

<pre>
<<strong>div </strong><strong>class=</strong><strong>"tcn02"</strong>>
    
    <<strong>H1</strong>>You are Writing this Post</<strong>H1</strong>>
    
    <<strong>form </strong><strong>action=</strong><strong>"insert.php" </strong><strong>method=</strong><strong>"POST"</strong>>

        <<strong>input </strong><strong>class=</strong><strong>"input_title" </strong><strong>type=</strong><strong

This is how it looks like when printing it:

<div class="tcn02">
    
    <H1>You are Writing this Post</H1>
    
    <form action="insert.php" method="POST">

        <input class="input_title" type=

What could be the problem here?

Link to comment
https://forums.phpfreaks.com/topic/291442-code-in-pre-tags-cuts-off/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.