title: How to delete item from dropdown menu on change, php
body: <p>I have select tag, and dropdown menu, I want to delete item, when it's selected, like, on change</p>
  <p>Here is my code:</p>
  <pre><code>    $db = mysqli_connect('localhost', 'root', 'root', 'php_wood');
    $sql = &quot;SELECT * FROM posts&quot;;
    $post = $db-&gt;query($sql);
  
      
    if(isset($_GET['postDelete'])){
  
        $delete = $_GET['postDelete'];
        
            $sql = &quot;DELETE FROM posts WHERE id = `$delete`&quot;;
  
          mysqli_query($db, $sql);
           
          }
  </code></pre>
  <p>I don't know where  is mistake, here is my form</p>
  <pre><code>   &lt;form action=&quot;delete.php&quot; method=&quot;get&quot;&gt;
      &lt;select     id=&quot;&quot; onchange=&quot;this.form.submit();&quot; name=&quot;postDelete&quot;&gt;
      &lt;?php 
              if($post-&gt;num_rows &gt; 0){
                  while($row = $post-&gt;fetch_assoc()){
                      ?&gt;
    &lt;option  value=&quot;&lt;?php echo $row['id']?&gt;&quot;&gt;&lt;?php echo $row['title']?&gt;&lt;/option&gt;
  
  
    &lt;?php
                  }
                }
    ?&gt;
          &lt;option value=&quot;&quot;&gt;
          &lt;/option&gt;
      &lt;/select&gt;
      &lt;/form&gt;
  </code></pre>