The issue is that the like button refreshes the page and the user has to scroll all the way back down just to pick up where they left off. This can be quite frustrating for users when I want to incorporate this on something more extensive
I quickly began the like button tutorial but again the refresh issue.
code
<h3><table width="800" border="0"> </h3> <form name="form2" method="post" action="" > <?php echo $likerror; ?> <?php if($profileOwner):?><div style="text-align:left;"><input type="submit" name="remove" id="remove" value="Delete Posts" /></div><?php endif;?> <tr style="text-decoration:underline; font-weight:500; font-size:x-large;" > <td width="50" height="50" align="center"></td> </tr> <?php while($rows = mysql_fetch_array($result9)){ ?> <tr> <td width="41" align="center"><?php if($profileOwner):?><input type="checkbox" name="checkbox[]" id="checkbox[]" value="<?php echo $rows['id']; ?>" /> <?php endif;?></td> <td width="750"> </h4></a><br> <h5><?php echo $rows['message']; ?> </h5><br> <?php echo $rows['date']; ?> <div width="30px" style="background:#282828; color: white; font-weight: bold; font-size: 14pt; text-align:center; margin-left: 560px; border-radius: 7px; padding-right: 1px; padding-top: 4px; margin-top: -35px; "> <a href="" onclick="like_add(', $rows['id'], ');"><img SRC="/images/icons/like.gif" HEIGHT="25" WIDTH="25" style="position:relative;"></a> <?php echo $rows['likes']; ?> Likes </div> <script type ="text/javascript" src="/js/like.js"></script> <script type ="text/javascript" src="/js/jquery.js"></script> <input type="hidden" name="replyto" id="replyto" value="<?php echo $username; ?>"/> <input type="hidden" name="id" id="replyid" value="<?php echo $user_id ?>"/> <input type="hidden" name="myid" id="myid" value="<?php print $myid; ?>"/> <input type="hidden" name="postdate" id="postdate" value="<?php print date("m.d.y"); ?>"/> <hr></td> <td width="70" align="center"><a href="profile.php?uid=<?php echo $rows['fromid']; ?>"><?php echo $rows['fromuser']; ?></a> <br><img src="/members/<?php echo $rows['imagelocation']; ?>/profile_image.jpg" width="50px" height="75px"> </td> </tr> <tr> <td colspan="3" align="center"> <?php } if($_POST['Post']){ $fromidpost = $_POST['myid']; $replyuser = $_POST['replyto']; $replysubject = $_POST['replysubject']; $comments = $_POST['comments']; $postdate = date("m.d.y"); $theirid = $_GET['uid']; $query = mysqli_query($myConnection, "INSERT INTO `wall` (fromid, fromuser, toid, touser, message, date, wallid, imagelocation) VALUES ('$myid', '$myusername', '$theirid', '$username', '$comments', '$postdate', '$theirid','$myid')") or die (mysqli_error($myConnection)); header("Location: http://www.yourtechview.com/source/prof ... d=$user_id"); } if($_POST['remove']){ $deleterror = lol; $checkbox1 =$_POST['checkbox']; $delete = $_POST['checkbox']; if($delete) { for($i=0;$i<$count;$i++) {$delpos = $checkbox1[$i]; $sql = "DELETE FROM wall WHERE id='$delpos'"; $result = mysql_query($sql); echo mysql_error(); } if($result){ ?> <?php if (!$checkbox){echo $deleterror;} ?> <?php header("Location: http://www.yourtechview.com/source/prof ... d=$user_id"); exit; } } mysql_close(); } else { } if($_POST['Update']){ $replyuser = $_POST['replyto']; $replysubject = $_POST['replysubject']; $comments = $_POST['comments']; $postdateu = date("m/d/y"); $theirid = $_POST['replyid']; $query = mysqli_query($myConnection, "INSERT INTO `wall` (fromid, fromuser, toid, touser, message, date, wallid, imagelocation) VALUES ('$user_id', '$username', '$user_id', '$replyuser', '$comments', '$postdateu', '$user_id','$myid' )") or die (mysqli_error($myConnection)); header("Location: http://www.yourtechview.com/source/prof ... d=$user_id"); } ?> </form> </table>note that the like button is within a form where the action is "post". Is this the problem and if so how do I get around it?