title: Redirect user to same page issue in php
body: <p>i am creating a blog in php, mysql(PDO). in the blog i create such logic, that when new user come then first it will login, after that he/she will be able to see the post and comments on it. Now iam facing a problem in comments section...
  I create a comment table where every user comment will save and when the admin approve the comment then the comment will show on the concerend page.</p>
  
  <p><strong>Main Problem:</strong></p>
  
  <p>When a user comment the the page reload and i get some notices, i know the reason of notices, and the reason is when a user click the post to view his contents in detail, the the post will open on behalf of Id, but when the user comment on the post and the page reload then the page can not find the concerned post id,and it will show notices...</p>
  
  <p>This is my comment table pic
  <img src="https://i.stack.imgur.com/7meCo.png" alt="enter image description here"></p>
  
  <p><strong>This is my post page code....</strong></p>
  
  <pre><code>&lt;?php
  session_start();
  include 'conn.php';
  if(!isset($_SESSION['user']))
  {
      header('location:signin.php');
  }
  $smt=$conn-&gt;prepare("SELECT * FROM post,images WHERE post.Id=images.Id");
  $smt-&gt;execute();
  ?&gt;
  &lt;?php include 'header.php';?&gt;
  &lt;?php
  if(isset($_SESSION['user']))
  {
      include 'nav.php';
  }
  else
  {
      include 'nav-simple.php';
  }
  ?&gt;
  
      &lt;div class="container-fluid"&gt;
      &lt;?php include 'right_sidebar.php';?&gt;
  &lt;div class="main-container-top" id="masonry-grid"&gt;
      &lt;?php while($rows=$smt-&gt;fetch(PDO::FETCH_OBJ)):
          ?&gt;
  
          &lt;div class="col-md-3 grid-item post-col"&gt;
  &lt;img src="image/&lt;?php echo $rows-&gt;Image_Name;?&gt;" data-echo="image/&lt;?php echo $rows-&gt;Image_Name;?&gt;" class="post-image"/&gt;
              &lt;h5&gt;Post On &amp;nbsp;&lt;?php echo $rows-&gt;Post_Date;?&gt;&lt;/h5&gt;
              &lt;a href="post-description.php?id=&lt;?php echo $rows-&gt;Id ?&gt;" &lt;h4&gt;&lt;?php echo $rows-&gt;Post_Title;?&gt;&lt;/h4&gt;&lt;/a&gt;
              &lt;p&gt;
                  &lt;?php echo $rows-&gt;Post;?&gt;
              &lt;/p&gt;
  
          &lt;/div&gt;
  
      &lt;?php endwhile;
  
      ?&gt;
  &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;?php include 'footer-content.php';?&gt;
  &lt;?php include 'footer.php';?&gt;
  </code></pre>
  
  <p><strong>Below is my Post description page code where i have a comment section, and this is the page where i am facing issues...</strong></p>
  
  <pre><code>&lt;?php
  session_start();
  include 'conn.php';
  $pic_id='';
  if(isset($_GET['id']))
  {
      $pic_id=$_GET['id'];
  }
  
  $smt=$conn-&gt;prepare("SELECT * FROM post,images WHERE post.Id = images.Id AND post.Id='".$pic_id."'");
  $smt-&gt;execute();
  $rows=$smt-&gt;fetch(PDO::FETCH_OBJ);
  $title=$rows-&gt;Post_Title;
  $img=$rows-&gt;Image_Name;
  $post=$rows-&gt;Post;;
  ?&gt;
  &lt;?php include 'header.php';?&gt;
  
  &lt;?php include 'nav.php';?&gt;
  
  &lt;div class="container-fluid"&gt;
      &lt;?php include 'right_sidebar.php';?&gt;
  &lt;div class="col-md-1"&gt;&lt;/div&gt;
  
      &lt;div class="col-md-9 main-container-top container"&gt;
  
          &lt;div class="media col-md-12 description-post"&gt;
  
  
             &lt;img src="image/&lt;?php echo $img;?&gt;" alt="&lt;?php echo $img;?&gt;" class="img-rounded img-responsive media-left img-description"/&gt;
              &lt;div class="media-body"&gt;
                 &lt;h4 class="h4 description-heading"&gt;&lt;?php echo $title;?&gt;&lt;/h4&gt;
                  &lt;p class="post-text text-justify text-info"&gt;
  
                      &lt;?php echo $post;?&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;
  
          &lt;br/&gt;
  
              &lt;div class="media col-md-12 comment-section"&gt;
  &lt;?php
  if(isset($_SESSION['comment-error']))
  {
  ?&gt;
      &lt;span class="alert alert-warning col-md-6 container col-md-offset-3"&gt;&lt;?php echo $_SESSION['comment-error']; ?&gt;&lt;/span&gt;
      &lt;?php
  }
  unset($_SESSION['comment-error']);
   if(isset($_SESSION['comment-success']))
  {
  ?&gt;
      &lt;span class="alert alert-success col-md-6 container col-md-offset-3"&gt;&lt;?php echo $_SESSION['comment-success']; ?&gt;&lt;/span&gt;
      &lt;?php
  }
  unset($_SESSION['comment-success']);
      ?&gt;
                  &lt;br/&gt;
                  &lt;span class="col-md-1 comment-pic"&gt;&lt;img src="profile%20picture/cv.jpg" alt="post image" class="img-thumbnail img-responsive comment-img"/&gt;&lt;/span&gt;
                  &lt;div class="media-body  comment-head col-md-10"&gt;
                      &lt;h6 class="h6"&gt;comment by &lt;a href="#"&gt;e&lt;/a&gt; on Thursday 9.00 PM&lt;/h6&gt;
                      &lt;p class="comment"&gt;&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
          &lt;br/&gt;
          &lt;div class="col-md-12 container"&gt;
              &lt;h4 class="description-heading h4 text-muted"&gt;Share your thought&lt;/h4&gt;
              &lt;br/&gt;
              &lt;form action="comment.php" method="post" class="col-md-12" id="commentForm"&gt;
                  &lt;textarea name="comment" id="" cols="100" rows="5" placeholder="Your comment"&gt;&lt;/textarea&gt;
  
                  &lt;br/&gt;
                  &lt;input type="submit" value="Post" name="cmsg" id="&lt;?php echo $pic_id;?&gt;" class="btn btn-info"/&gt;
                  &lt;br/&gt;
              &lt;/form&gt;
          &lt;/div&gt;
          &lt;br/&gt;
  
  
  
  &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;?php include 'footer-content.php';?&gt;
   &lt;?php include 'footer.php';?&gt;
  </code></pre>
  
  <p>In the post-description page a comment section has, where a user post comment, but when the comment post the it will show some notices..
  Example..</p>
  
  <p><strong>Before the comment post</strong></p>
  
  <p><img src="https://i.stack.imgur.com/naIXc.png" alt="enter image description here"></p>
  
  <p><strong>After the comment post...</strong>
  <img src="https://i.stack.imgur.com/03TAr.png" alt="enter image description here"></p>
  
  <p>You can clearly see that when the comment are post and the page reload then it will show notices..</p>
  
  <p><strong>my comment.php code</strong></p>
  
  <pre><code>&lt;?php
  session_start();
  include 'conn.php';
  $comment=$_POST['comment'];
  $status='Pending for approvial';
  $smt=$conn-&gt;prepare("INSERT INTO user_comment(Comment,Status,On_Time)VALUES ('".$comment."','".$status."',now())");
  $smt-&gt;execute();
  if($smt)
  {
      $_SESSION['comment-success']='Your Comment is Pending for approvial';
      header('location:post-description.php');
  }
  else
  {
      $_SESSION['comment-error']='There si something wrong with your account';
      header('location:post-description.php');
  }
  ?&gt;
  </code></pre>
  
  <p><strong>What i want:</strong></p>
  
  <p>I am able to show the success message after the user comment but i am not able to solve the notices issue, because when the page reload then it will not find the post id.how can i redirect the user to the same post but without getting any errors...</p>
  
  <p>Hope this detail is enough to understand the issue...</p>
  
  <p><em>Any blog,comments, user related idea will be appreciated...</em> </p>