Jump to content

Code in Pre Tags Cuts Off


glassfish
Go to solution Solved by jcbones,

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?

Edited by glassfish
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.