<?php while(the condition here) {
$honeyid = $row['id'];
?>
<form action="<?=$website_url;?>/writecomment.php" name="writecomment" method="post" id="writecomment<?php echo $honeyid; ?>">
<fieldset style="margin:3px; padding:3px; <?php if( $loggedin == "yes" ) { ?>width:410px;<?php } else { ?>width:360px;<?php } ?> background-color:#EEEEEE; border:1px solid #EEEEEE;">
<?php if( $loggedin == "yes" ) { ?><section_write style="float:left; padding:0px 3px; margin:0px 3px;">
<?php
$users2 = mysqli_query($con, "SELECT avatar, fullname FROM users WHERE username = '$_SESSION[username]'");
$user2 = mysqli_fetch_array($users2);
if (strlen($user2['avatar']) == 0) {
$img = 'http://placeimg.com/90/90/nature';
} else {
$img = $website_url . '/assets/img/avatars/'. $user2['avatar'];
}
?>
<a href="<?=$website_url;?>/user/<?php echo urlencode($_SESSION['username']); ?>">
<img src="<?= $img; ?>" width="30px" height="35px" title="<?= $user2['fullname']; ?>" border="0" />
</a>
</section_write><?php } ?>
<textarea style="width:350px;height:23px" name="contectcomment" id="contectcomment<?php echo $honeyid; ?>"></textarea>
<br />
<?php if( $loggedin == "yes" ) { ?><input type="checkbox" value="1" id="commentanonim<?php echo $honeyid; ?>" name="commentanonim" checked="checked" style="margin:3px; padding:3px;" /><label for="commentanonim<?php echo $honeyid; ?>">Anonymously</label> <?php } ?><input type="submit" value=" Comment " class="comment_submit" name="dergokomentin" id="dergokomentin<?php echo $honeyid; ?>" /><input type="hidden" name="tbhidkoment" value="<?php echo $honeyid; ?>" />
</fieldset>
</form>
<script>
$("#writecomment<?php echo $honeyid; ?>").submit(function(){
$.post( $("#writecomment<?php echo $honeyid; ?>").attr("action"),
$("#writecomment<?php echo $honeyid; ?> :input").serializeArray(),
function(info){
$("#contectcomment<?php echo $honeyid; ?> :input").each( function() { $(this).val(''); });
$("#commentanonim<?php echo $honeyid; ?>").val("1");
$("#shikokomentet<?php echo $honeyid; ?>").load("<?=$website_url;?>/loadcomments.php?id=<?php echo $honeyid; ?>");
});
});
$("#writecomment<?php echo $honeyid; ?>").submit( function() {
return false;
});
</script>
<?php } ?>
好的,这是我的代码。我正在尝试建立一个评论系统,我想要实现的是,当用户点击“评论”按钮时,我想清理textarea并加载其他页面,因为它写在代码中。但它不起作用!我一直在研究这个问题4个小时但仍然没有任何线索。知道为什么这不起作用吗?
由于