title: Delete Selected row of selected ID using PHP and Javascript
body: <p>I am trying to delete a row of selected ID by passing a parameter into URL. let say, I have entryIDs 1 and 2, whenever I try to select and delete the content of entry 1, it successfully deletes the content of entryID 1 but the problem is when I choose to delete entryID 2 it still deletes entryID 1 instead of 2. I am thinking the content of a variable <code>var row = '".$rows['Blog_ID']."';</code> doesn't change and only retains the value of entryID 1 even though I choose otherwise.</p>
  
  <p>Here is what I tried so far..</p>
  
  <pre><code>&lt;?php
  include("../Connection.php");
  $post_query="Select * from indexview order by Blog_ID Desc";
  $postsql=mysqli_query($connect_db,$post_query) or die('Connection unsuccessful');
  
      while($rows=mysqli_fetch_array($postsql,MYSQL_ASSOC)){
          echo "&lt;div id='posts'&gt;";
      echo" &lt;select onchange = 'down(this.value)' id='downpng' name='downpng'&gt;
                  &lt;option value='void'&gt;&lt;/option&gt;
                  &lt;option value = 'edit'&gt;Edit Blog&lt;/option&gt;
                   &lt;option value ='delete'&gt;Delete&lt;/option&gt;
          &lt;/select&gt;​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​";
  
  
          echo 
          "&lt;script&gt;
  
               function down(temp) {
  
                  var row = ".$rows['Blog_ID'].";
                  var id = '".$_GET['id']."';
  
  
  
                  if(temp=='delete'){
  
                      var con = confirm('Are you sure?');
                      if(con){
                          window.location = 'google.php?entryID=' + row + '&amp;id=' + id;
  
                          }else{
                              window.location = '../Blog/Blog.php?id=".$_GET['id']."';
                          }
  
      }else{
          window.location = '../Blog/edit.php';
      }
  }
  &lt;/script&gt;";
  </code></pre>
  
  <p>When I select <code>&lt;option value ='delete'&gt;Delete&lt;/option&gt;</code> it is supposed to redirect me into deleteBlog.php page and delete the content of selected entryID. </p>
  
  <p>deleteBlog.php code:</p>
  
  <pre><code>&lt;?php
  include("../Connection.php");
  
  if(isset($_GET['entryID'])){
  
  
  $user = $_GET['id'];
  $entry = $_GET['entryID'];
  
  mysqli_query($connect_db, "Delete from blog_tbl where Blog_ID=" .$entry);
  header('Location: ../Blog/Blog.php?id='.$user);
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>Any suggestions will be much appreciated. Thanks!</p>