runnerjp Posted September 7, 2008 Share Posted September 7, 2008 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 More sharing options...
steveclondon Posted September 7, 2008 Share Posted September 7, 2008 I see your post[''] above but where does it pass the threadid or topic id. You will need to collect these by post. topicID=$_POST['topicID']; as an example Link to comment https://forums.phpfreaks.com/topic/123101-solved-cant-delete-or-edit-posts/#findComment-635740 Share on other sites More sharing options...
runnerjp Posted September 7, 2008 Author Share Posted September 7, 2008 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 https://forums.phpfreaks.com/topic/123101-solved-cant-delete-or-edit-posts/#findComment-635744 Share on other sites More sharing options...
steveclondon Posted September 7, 2008 Share Posted September 7, 2008 Yes you have collected $_POST['message'], but where have you collected $_POST['thradid'] Link to comment https://forums.phpfreaks.com/topic/123101-solved-cant-delete-or-edit-posts/#findComment-635746 Share on other sites More sharing options...
runnerjp Posted September 7, 2008 Author Share Posted September 7, 2008 ahh yes its supposed to be topicid... thanks for pointing me the right way Link to comment https://forums.phpfreaks.com/topic/123101-solved-cant-delete-or-edit-posts/#findComment-635763 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.