Jump to content
MakeWebGames

Anyone know what i'm doing wrong


Cronic

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...