I'm trying to get my forums to redirect back to the posted reply after someone replies to a topic.
The current coding inserts the value into the mysql table, then sets a five second cookie with the value of the topic ID and then redirects:
The Redirect page then is supposed to take the values of the topic and post ID's and use them to direct to the said topic. The problem is that the redirect page fails to read the cookies at all and just goes to the default home page which it's supposed to do if the $_COOKIE['fkumc_reply_topic'] isn't set (which is set by the reply function). Is there a reason that the page can't read the cookie?
Also, if there is a better way to do this, please tell me, because I'm thinking my coding is over-complicated.
The current coding inserts the value into the mysql table, then sets a five second cookie with the value of the topic ID and then redirects:
| Code: |
|
$addpost_query = "INSERT INTO posts (poster_id,topic_id,post_entry,post_date,board_id) VALUES ('".$_SESSION['fkumc_u_id']."','".$topic_id."','".$post."',now(),'".$board_id."')"; mysql_query($addpost_query) or die(mysql_error()); setcookie('fkumc_reply_topic', $topic_id ,time()+5); setcookie('fkumc_reply_post', $post_num ,time()+5); header ("Location: /FKUMC/redirect.php");}} |
The Redirect page then is supposed to take the values of the topic and post ID's and use them to direct to the said topic. The problem is that the redirect page fails to read the cookies at all and just goes to the default home page which it's supposed to do if the $_COOKIE['fkumc_reply_topic'] isn't set (which is set by the reply function). Is there a reason that the page can't read the cookie?
Also, if there is a better way to do this, please tell me, because I'm thinking my coding is over-complicated.
