Jump to content

[SOLVED] cant delete or edit posts


runnerjp

Recommended Posts

here is my code

 

<?php 
      $topicid=$_GET['id']; 
if (isset($_POST['edit'])) { 
              if ($_POST['deletepost'] == 'deletepost'){ 
        $threadid =  mysql_real_escape_string( $_POST['id']); 
        mysql_query("DELETE FROM forumtutorial_posts WHERE postid='$threadid'")  
or die(mysql_error()); 
mysql_query("UPDATE `forumtutorial_posts` SET `numreplies`=`numreplies`-'1' WHERE `postid`='$topicid'")  
or die(mysql_error());  
header( "refresh: 0; url=http://www.runningprofiles.com/members/index.php?page=message&forum=general&id=$id");   
    } else { 
  //	$threadid =  mysql_real_escape_string( $_POST['id']);
$threadid =  $CONT_ID;
    $message = $_POST['message']; 
    echo $message;  
     $query = "UPDATE forumtutorial_posts SET  post = '$message' WHERE postid='$threadid' "; 
    mysql_query($query) or die('Error, query failed'); 
    header( "refresh: 0; url=http://www.runningprofiles.com/members/index.php?page=message&forum=general&id=$id");   
     
} 



     


}else{ 


?> 

<script src="../../css/SpryCollapsiblePanel.js" type="text/javascript"></script> 
      <link href="http://www.runningprofiles.com/css/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" /> 
      <div id="CollapsiblePanel<?PHP 
       // I had to add $CONT_ID that is set in the script that includes this. and ive done it again for the "tabindex" just to ensure it works!
      echo $CONT_ID; ?>" class="CollapsiblePanel"> 
  <div class="CollapsiblePanelTab" tabindex="<?PHP echo $CONT_ID; ?>"> Edit</div> 
  <div class="CollapsiblePanelContent"> 
<form name='input' action='index.php?page=message&forum=general&id=<? echo $id ?>' method='post'> 
    <input type="hidden" name="id" value="<?php echo $getreplies3['postid'] ?>"> 
    <div align="center"> 
      <label> 
      <textarea class='inputforum' name="message" id="message" cols="500" rows="5"><? echo $message; ?></textarea> 
      </label> 
            <input type="checkbox" name="deletepost" value="deletepost" /> 
     delete post<br/> 
      <br/> 
       
       
        <input type='submit' name='edit' class="submit-btn"  value=''/> 
  </div> 
</form>      <? 
} 
?></div> 
</div> 


<script type="text/javascript"> 
<!-- 
<?PHP
//Ive added the variable $CONT_ID here aswell. THIS IS REQUIRED FOR THE
//JS to work!
?>
var CollapsiblePanel<?PHP echo $CONT_ID; ?> = new Spry.Widget.CollapsiblePanel("CollapsiblePanel<?PHP echo $CONT_ID; ?>", {contentIsOpen:false}); 
//--> 
      </script>

 

for some reason the posts wont delete or edit but if i hit delete it till -1 off the postcount

 

any1 have any reason why?

Link to comment
Share on other sites

but i have...

 

i have this <textarea class='inputforum' name="message" id="message" cols="500" rows="5"><? echo $message; ?></textarea>

 

then its followed by

 

$message = $_POST['message'];

    echo $message; 

    $query = "UPDATE forumtutorial_posts SET  post = '$message' WHERE postid='$threadid' ";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

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

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.