如何在表单中使用contenteditable。当我提交它时,它会显示消息"描述为空"? 名称必须是name =" description"
<form action="" method="post">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<table>
<tr><td>Titulli i postimit</td><td><input type="text" name="title" value="<?php echo $title; ?>"/></td></tr>
<tr><td>Pëshkrimi</td><td><p name="description" contenteditable="true"><?php echo $description; ?></p></td></tr>
<tr><td>Krijuar më</td><td><i><?php echo $published; ?></i></td></tr>
<tr><td>Krijuar nga</td><td><b><?php echo $publisher; ?></b> dhe ndryshimet do të bëhen mbi <?php if (!isset($_SESSION['User'])) { echo "Login!"; } else { echo "$name";} ?></td></tr>
<tr><td>Data e ndryshimit</td><td><i><?php echo date('d.m.Y'); ?></i><input type="hidden" name="date" value="<?php echo date('d.m.Y'); ?>" /></td></tr>
<tr><td>Aktiv</td><td><input type="radio" name="vehicle" value="Po" id="pcheck"><label for="pcheck">Po</label><input type="radio" name="vehicle" value="Jo" id="ncheck"><label for="ncheck">Jo</label></td></tr>
<tr><td></td><td><input type="submit" name="submit" value="Submit" /></td></tr>
</table>
</form>
以下是我正在谈论的界限:
<tr><td>Pëshkrimi</td><td><p name="description" contenteditable="true"><?php echo $description; ?></p></td></tr>
答案 0 :(得分:-2)
<p name="description" contenteditable="true"><?php echo $description; ?></p>
您无法以您希望的方式将name
指定给<p>
。更改为<textarea>
:
<textarea name="description" contenteditable="true"><?php echo $description; ?></textarea>