Jump to content

HellFire100x

New Members
  • Posts

    1
  • Joined

  • Last visited

HellFire100x's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i'm a beginner at php coding so this is what i've created.. well to be simple..i need to create a delete button for every post and i have created a button..but when i click that button all posts get deleted what i'm basically doing is that..i'm making a submit button appear beside every post..but when i click one button all of them are getting deleted...can u correct the code ? its like the button only has to delete the post to which it was assigned to..thanks alot.. while($row = mysql_fetch_assoc($result)){ echo '<tr>';echo '<td class="leftpart">';echo '<h3><a href="topic.php?id=' . $row['topic_id'] . '">' . $row['topic_subject'] . '</a><br /><h3>';echo '</td>';echo '<td class="rightpart">';echo date('d-m-Y', strtotime($row['topic_date']));echo '</td>'; echo '</tr>';if($_SESSION['signed_in'] == true && $_SESSION['user_level'] == 1 ){ echo '<form name="form" method="post"> <td><input type="submit" NAME="button1" value="Delete" /></td></form>';if(isset($_POST['button1'])){ mysql_query("DELETE FROM topics WHERE topic_id=" . $row['topic_id'] . ""); } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.