Ok so me and a friend have been coding a kinda posting site and we made a like button but when clicked it likes all the posts on the page… is there any way to fix this? [php]
<?php require('connection.php'); if(isset($_POST['name'] , $_POST["post"]) && $_POST['name'] != '' && $_POST['post'] != ''){ $post = mysql_real_escape_string($_POST['post']); $message = ''; $name = mysql_real_escape_string($_POST['name']); mysql_query(" INSERT INTO posts (name, post) VALUES('$name', '$post') ") or die(mysql_error()); } else { $message= 'Please enter something'; } $query = mysql_query(" SELECT * FROM posts ORDER BY posts.timestamp "); while($row = mysql_fetch_array($query)) { echo '<form action="wall.php" method="post">
<input type="hidden" value="1" name="likes">
<button type="submit">like</button>
<?php
echo '</div>';
}
?>
NamePost
Submit <?php
echo $message;
?>[/php]
thanks in advance