私はデータベースの元のコンテンツをコンテンツに埋め込む編集ページを持っています。私はインラインphpを使用しています。これによりタイトルがフィールドに取り込まれ、他のフィールドもすべて機能します。同じメソッドを使用してテキストエリアを入力しようとすると、動作しません。 他のすべてのフィールドは、textarea(テキスト)以外はvarcharです。 phpはフォームの値にあります。データベースからの結果をテキストエリアに取得
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