Search code examples
phphtmlblogs

I want to echo out blog posts uneditable


I am currently working on a blog. On the post view I want to echo my form from the new blog post, but just with filled values of my database. How can I do that, without it is editable and it just shows the values in the boxes. I was able to get the value into my comment field $p_text but it is still editable.

echo "
<main class='my-form'>
    <div class='cotainer'>
        <div class='row justify-content-center'>
            <div class='col-md-8'>
                    <div class='card'>
                        <div class='card-header'>Dein Beitrag!</div>
                        <div class='card-body'>
                        <div class='titeltextbox'>
                            <div class='form-group'>
                                <label for='inputName'>Titel</label>
                                    <input class='form-control' type='text'/>

                            </div>

                                <div class='form-group row'>
                                    <label for='email_address' class='col-md-1 col-form-label text-md-right'>Miete</label>
                                    <div class='col-md-3'>
                                        <input type='text' id='email_address' class='form-control' name='$miete'/>
                                        <span class='help-inline'>  Wie viel gibst du für deine Miete aus?</span>
                                    </div>
                                </div>


                                <div class='form-group row'>
                                    <label for='user_name' class='col-md-1 col-form-label text-md-right'>Einkauf</label>
                                    <div class='col-md-3'>
                                        <input type='text' id='user_name' class='form-control' name='$einkauf'/>
                                        <span class='help-inline'>  Was gibst du circa für deinen monatlichen Einkauf aus? </span>
                                    </div>
                                </div>

                                <div class='form-group row'>
                                    <label for='phone_number' class='col-md-1 col-form-label text-md-right'>Freizeit</label>
                                    <div class='col-md-3'>
                                        <input type='text' id='phone_number' class='form-control' name='$freizeit'/>
                                        <span class='help-inline'>  Gibt es monatliche Beiträge für Hobbies?</span>
                                    </div>
                                </div>

                                <div class='form-group row'>
                                    <label for='present_address' class='col-md-1 col-form-label text-md-right'>Sonstiges</label>
                                    <div class='col-md-3'>
                                        <input type='text' id='present_address' class='form-control' name='$sonstiges'/>
                                        <span class='help-inline'>  Welche sonstigen laufnden monatlichen Kosten hast du?</span>
                                    </div>
                                </div>

                                  <div class='form-group row'>
                                    <label for='present_address' class='col-md-1 col-form-label text-md-right'>Kosten<p>(Gesamt)</p></label>
                                    <div class='col-md-3'>
                                        <input type='text' id='present_address' class='form-control' name='$g_kosten'/>
                                        <span class='help-inline'>  Alle Kosten addiert</span>
                                    </div>
                                </div>

                                <div class='textbox'>
                                <div class='offset-md-0'>
                                  <label for='comment'>Persoenlicher Kommentar:</label>
                                    <textarea class = 'form-control' id='comment' rows='5'>$p_text</textarea>
                                    <div id='charNum'></div>
                                </div>
                                </div>
                        </div>
                    </div>
            </div>
        </div>
    </div>
</main>     
";

Solution

  • add disables to textarea tag

    <textarea disabled class = 'form-control' id='comment' rows='5'>$p_text</textarea>