【发布时间】:2014-03-15 17:29:19
【问题描述】:
我使用 php 从 html5 表单中获取数据,我正在尝试保留字段的数据并且不被清除。
它适用于输入,但对于 textarea(描述字段)失败。
您可以在下面看到我在输入中添加了一个 php echo 作为值,但它不适用于 textarea。 我怎样才能使它也适用于 textarea?
HTML 表单:
<form method='post' action='entry.php' enctype="multipart/form-data">
<label for="username"> Username: </label>
<input type="text" name="username" id="username" value="<?php echo $username; ?>" /></br>
</br>
<label for="email">Email:</label>
<input type="email" name="email" value="<?php echo $email; ?>"/> </br></br>
<label>Title of monument:</label>
<input type="textbox" name="title" value="<?php echo $title; ?>" /></br></br>
<label>Description of monument:</label>
<textarea cols="50" rows="6" name="description" value="<?php echo $description; ?>" /></textarea></br></br>
<label>Select image:</label>
<input type="file" name="file" ></br></br>
<input type="submit" value="Submit" name="submit" >
</form>
【问题讨论】:
-
失败怎么办?请澄清。
-
您有很多换行元素缺少(强制)开始标签但有(禁止)结束标签! (无论如何,您不应该使用换行符来模拟边距)。