Piszę system newsów z komentarzami i napotkałem mały problem, a mianowicie w pierwszym newsie (położonym najwyżej) mogę pisać komentarze bez problemu, ale w 2 po naciśnięciu "OK" przenosi mnie do "newcomment.php".
<?php ?> <div id="news"> <div class="more-less"> <div class="more-block"> <p style="float: right; padding-bottom: 0px; margin-bottom: -5px;"><?=date('d.m.Y, H:m:s', $row['news_adate'])?></p> <p style="float: left; padding-bottom: 0px; padding-left: 0px; margin-bottom: -10px;"><b><?=$row['news_title']?></b></p> <p style="clear: both; padding-bottom: 0px; margin-bottom: -5px;"></p><hr> <div style="margin-top: 2px;"> <div style="float: left;"><?php echo "<img src='../Addons/Uploads/".$row['news_image']."' width='158px' height='158px'>";?></div> <div style="float: left; width: 5px; height: 158px;"></div> <div style="text-indent: 25px;"><?=$row['news_content']?></div> <div style="clear: both;"></div> </div> </div> </div> <hr> <?php $newsid = $row['news_id']; ?> <p style="text-align: right; padding-bottom: 0; padding-top: 0;">(0) <f_link><a href="java script:showonlyone('<?=$row['news_id'];?>')" style="cursor: pointer;">- komentarze - </a></f_link></p> <div class="comments" id="<?=$row['news_id']?>"> <?php if($_SESSION['logged']) { $user_data = get_user_data(); $author = $user_data['user_login']; ?> <div id="new_comment"> Napisz komentarz:<br /> <form id="newComment" action="newcomment.php" method="post"> <input type="hidden" name="author" value="<?=$author;?>"> <input type="hidden" name="newsid" value="<?=$newsid;?>"> <div style="float: left;"><textarea name="comment" rows="2" cols="90" value="<?=$_POST['comment']?>"></textarea></div><div style="float: left;"><input type="submit" value="OK" style="width: 40px; height: 34px; margin-left: 3px;"/></div> <div style="clear: both;"></div> </form> </div> <?php ?> </div> </div> <?php }; ?>
<script> $(document).ready(function() { $('#newComment').ajaxForm(function() { $('#newComment').resetForm(); }); }); </script>
W "newcomment.php" mam tylko wysłanie danych do bazy.
Na czym polega problem?
Z góry dziękuję.