Cronic Posted September 7, 2012 Share Posted September 7, 2012 Hi everyone, I'm trying to get a confirm message to delete a forum post / thread into my game. Here's the code: if(isset($_POST['delete'])) { if(isset($_POST['deleteconfirm']) != "agree"){ echo Message("<div>You haven't agreed to delete the forum post.</div>"); include 'footer.php'; die(); } $result1 = mysql_query("SELECT * FROM `freplies` WHERE `postid` = '".$_POST['postid']."'"); $worked = mysql_fetch_array($result1); $result = mysql_query("DELETE FROM `freplies` WHERE `postid` = '".$_POST['postid']."'"); echo Message("The selected post was deleted."); StaffLog($user_class->id, "[-_USERID_-] has deleted a post. Post by: [-_USERID2_-]. <a href='viewpost.php?id=".$_GET['id']."' target='_blank'>View Topic</a>.", $worked['playerid']); } // Display the forum post & delete link: if ($user_class->admin == 1 || $user_class->gm ==1 || $user_class->fm ==1) { ?><form method="post"><input type="hidden" name="postid" value="<?php echo $row['postid']; ?>" /><input type="submit" name="delete" value="Delete Post" /></form><font size="-9px">Confirm Delete</font> <input type="checkbox" name='deleteconfirm' value="agree" /><?php } ?> But it keeps saying that I haven't confirmed it whilist I have selected it to delete, Does anyone know what i'm doing wrong? Any help is much appreciated.:D Quote Link to comment Share on other sites More sharing options...
Newbie Posted September 7, 2012 Share Posted September 7, 2012 i have not worked with grpg so im not to sure but whats this ? $row['postid']; i dont see $row in the above code wouldnt it be $_POST['postid'] probz wouldnt listen to me lol am learning but to me it looked wrong but i would wait for one of the more experienced coders to have a look Quote Link to comment Share on other sites More sharing options...
Djkanna Posted September 7, 2012 Share Posted September 7, 2012 How about putting your checkbox within your form? Quote Link to comment Share on other sites More sharing options...
Guest Posted September 7, 2012 Share Posted September 7, 2012 If your trying to get a confirm delete, you could just use a bit of JS, onClick="return confirm('Are you sure you want to delete this?')" So then they don't have to go to another page it's just a simple pop up box :) Quote Link to comment Share on other sites More sharing options...
Cronic Posted September 7, 2012 Author Share Posted September 7, 2012 Thanks Ian! Haven't thought of that. It does work now, thank you for your help. :D Quote Link to comment Share on other sites More sharing options...
Cronic Posted September 7, 2012 Author Share Posted September 7, 2012 i have not worked with grpg so im not to sure but whats this ? $row['postid']; i dont see $row in the above code wouldnt it be $_POST['postid'] probz wouldnt listen to me lol am learning but to me it looked wrong but i would wait for one of the more experienced coders to have a look $row['postid'] is the current forum post id they are trying to delete. :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.