0
我在貼兩件東西。評論,這工作正常,但我需要發佈的第二個項目是$list['id']
,這是唯一的這一行。當用戶單擊POST時,如何包含此唯一ID,以便它可以在發佈到的頁面上使用。發佈一個行唯一的變量,我該怎麼做?
foreach ($posts as $key => $list){
echo " <tr valign='top'>\n";
echo " <tr>$list['id']
<div class='comment_text'>
<form method='post' action='add_comment.php'>
<textarea name='comment'</textarea>
<input class='btn' type='submit' value='Post'/>
</form>
</div>
</td>\n";
echo "</tr>\n";
}
頁面我張貼到看起來像這樣:
<?php
$commenter_user_id = $_SESSION['user_id'];
$body = substr($_POST['comment'],0,400);
$post_id=;
add_comment($commenter_user_id,$post_id,$body);
$_SESSION['message'] = "Your comment has been added!";
header("Location:/social_learning/site_pages/profile.php");
?>
這是現有的數據(如允許用戶編輯信息)? – SenorAmor 2012-04-08 02:56:25
目前我可以發表評論,但我不知道如何發佈$ list ['id']列表['id']是用戶將評論的帖子的名稱。我是不知道如何將它發佈到add_comment頁面以及評論主體。該用戶也在發帖。 – arboles 2012-04-08 03:12:50