Reformulating the question:
Foreachpost,Ihaveafeedbackform.WhatIneedtodoispasstheformidtothescriptsoIcanhandlethecommentinthepost.
However,topassthevaluetothedivprocess,Iwouldneedtosomehowputtheidofthenewcommentonthatdiv,sowhenthereisanothercomment,thedivisnotreplacedbutadded.
Thisformissentbypressingtheenterkey.
Ineedtoknowhowtosendthepostidintothescripttoget$a("# myForm" + valueId) .ajaxForm ({instead of $ ("# myForm9").) ajaxForm ({
Is there any way to send the result echo '
<span>'.$posting.'</span><div class="cimg_box"><img class="comment_img" src="css/images/profile_photo/'.$user['photo'].'"/></div>';
};
with a div so that this div of id = 'processes'. $ commentId.' is displayed instead of calling an already defined div with a fixed id.
if ($rows > 0){
echo '<div class="comment_all clearfix" style="display: none" id="reply_box'.$post['id_p'].'">';
while($comment = mysqli_fetch_assoc($query3)){
echo '
<div class="comment_box">
<span>'.$comment['text'].'</span><div class="cimg_box"><img class="comment_img" src="css/images/profile_photo/'.$comment['photo'].'"/></div>
</div>';
}
echo '
<div id="processa" class="comment_box">
</div>
</div>';
}
echo '
<div class="comm_box_reply" >
<div class="reply_box"><img class="img_friend2" src="css/images/profile_photo/'.$user['photo'].'"/>
<form id="myForm'.$post['id_p'].'" value="'.$post['id_p'].'" name="rform" class="reply_form" action="processing.php" method="post">
<textarea name="editor1" id="text'.$post['id_p'].'" onclick="rpbox(this.id, '.$post['id_p'].')" class="imagem_news" placeholder="Your Comment..." ></textarea>
<input name="formValue" type="text" value="'.$post['id_p'].'" hidden/>
</form>
</div>
</div>
$(document).ready(function() {
$("#processa").hide();
$("#myForm9").ajaxForm({ /*Preciso modificar aqui para colocar a id do post*/
target: "#processa",
success: function(){
$("#processa").show();
}
});
});'
<?php
include("config.php");
if ($_POST['editor1'] != ''):
$uid = $_SESSION['userId'];
$postId = $_POST["formValue"];
if((isset($_POST["editor1"])) ? $_POST["editor1"] : ''){
$posting = (isset($_POST["editor1"])) ? $_POST["editor1"] : '';
$date = date("Y-m-d H:i:s");
$sql = "INSERT INTO comments (id_c, post_id, author_id , text, date) values ('', '$postId', '$uid', '$posting', '$date')";
mysqli_query($conn,$sql);
$query4 = mysqli_query($conn,"SELECT * FROM 'profile' WHERE 'id' = '$uid'") or die(mysqli_error($conn));
$user = mysqli_fetch_array($query4);
$proc = mysqli_insert_id($conn);
echo '
<span>'.$posting.'</span><div class="cimg_box"><img class="comment_img" src="css/images/profile_photo/'.$user['photo'].'"/></div>';
};
else:
echo 'Error!';
endif;
?>