데이터베이스의 원본 컨텐츠로 내용을 채우는 편집 페이지가 있는데, 인라인 PHP를 사용하여 필드를 제목으로 채우고 다른 모든 필드도 작동합니다. 시도하고 동일한 방법을 사용하여 텍스트 영역을 채울 때 작동하지 않습니다. 다른 모든 필드는 텍스트 인 textarea를 제외하고 varchar입니다. PHP는 형식 값에 있습니다.데이터베이스에서 textarea로 결과 가져 오기
require_once('includes/db.inc.php');
$stmt = $mysqli->prepare("SELECT
postID,title,content,author,image
FROM posts where postID = ?");
$stmt->bind_param("i",$_GET['postID']);
$stmt->execute();
$stmt->bind_result($postID,$title,$content,$author,$image);
$stmt->fetch();
$stmt->close();
?>
<section id="createPost">
<form method="post" action="editPost.php">
<fieldset>
<legend>Edit Post: <?php echo $title ?></legend>
<input name="postID" type="hidden" value="<?php echo $postID; ?>">
<label for="titleOfPost">Title of Post:</label><br />
<input type="text" name="titleOfPost" size="82" placeholder="Enter title of post" required value="<?php echo $title ?>"><br />
<label for="bodyOfPost">Content of Post:</label><br />
<textarea cols="60" name="postContent" rows="10" placeholder="HTML tags allowed" value="<?php echo $content ?>"></textarea><br />
<label for="authorOfPost">Author:</label><br />
<input type="text" name="authorOfPost" size="82" placeholder="Author name" required value="<?php echo $author ?>"><br />
<label for="imageOfPost">Image:</label><br />
<input type="text" name="imageOfPost" size="82" placeholder="image" value="<?php echo $image ?>"><br />
<input type="submit" name="newPostBtn" value="EditPost" id="newPostBtn"/>
</fieldset>
</form>
</section><!--end createPost-->
무언가가 작동하지 않을 때마다 항상 항상 항상 항상 생성 된 HTML 소스 코드를보고 시작해야합니다. 만약 당신이 그렇게했다면, 데이터가 실제로 브라우저로 보내지고 이것이 PHP/MySQLi 문제가 아니라 'textarea' 태그의 오해로 인한 간단한 HTML 문제라는 것을 알았을 것입니다. – kba