我目前正在写博客。在帖子视图中,我想从新的博客帖子中回显我的表单,但仅使用数据库的填充值。如果没有可编辑的内容,而只是在框中显示值,我该怎么做。我可以将其值输入到我的注释字段$p_text
中,但它仍可编辑。
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>
";
答案 0 :(得分:1)
添加禁用textarea标记
<textarea disabled class = 'form-control' id='comment' rows='5'>$p_text</textarea>