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
https://forums.phpfreaks.com/topic/123101-solved-cant-delete-or-edit-posts/
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' ";

Archived

This topic is now archived and is closed to further replies.

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