title: PDO I can't get the title to show in the select tag from a query made in php
body: <p>I'm trying to get the select tag to show the titles of the posts that are in the DB so i can select them individually and up date them instead of updating all the titles with the same name.</p>
  
  <p>So my problem is that i can't get it to work and maybe someone may be able to help me.</p>
  
  <p>This is what i mean-><a href="https://imgur.com/a/ie1g4hF" rel="nofollow noreferrer">https://imgur.com/a/ie1g4hF</a></p>
  
  <p>if you want the full version you can get it from my github:</p>
  
  <p><a href="https://github.com/TwistedZebra/blog" rel="nofollow noreferrer">https://github.com/TwistedZebra/blog</a></p>
  
  <p>That version up there does not contain the select tags but uses a text box to delete the post that is named but with a disadvantage of deleten every post named the same.</p>
  
  <pre><code>&lt;?php 
      require 'config.php';
  
  
      if (isset($_POST['submit'])) {
          $updatetitle = $_POST['updatetitle'];
          $title = $_POST['title'];
          $content = $_POST['content'];
  
          if (empty($title) || empty($content)) {
              header('Location: update.php?=error');
              exit();
          } else {
              $updatedcontent = $connection-&gt;prepare('UPDATE posts SET title = :title , content = :content WHERE title = :updatetitle');
              $updatedcontent-&gt;execute(['title' =&gt; $title, 'content'=&gt; $content, 'updatetitle' =&gt; $updatetitle]);
              header('Location: update.php?=success');
          }
  
      }
   ?&gt;
  
   &lt;!DOCTYPE html&gt;
   &lt;html&gt;
   &lt;head&gt;
      &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"&gt;
      &lt;link rel="stylesheet" type="text/css" href="public/css/main.css"&gt;
      &lt;title&gt;Control panel&lt;/title&gt;
   &lt;/head&gt;
   &lt;body&gt;
  
      &lt;div class="navbar navbar-expand-lg navbar-dark  bg-dark"&gt;
          &lt;div class="navbar-brand "&gt;
              &lt;h2&gt;BloggerWorld&lt;/h2&gt;
          &lt;/div&gt;
          &lt;ul class="nav"&gt;
              &lt;li class="nav-item"&gt;
                  &lt;a class="nav-link" href="public/index.php"&gt;Home&lt;/a&gt;
              &lt;/li&gt;
              &lt;li class="nav-item"&gt;
                  &lt;a class="nav-link" href="public/posts.php"&gt;Posts&lt;/a&gt;
              &lt;/li&gt;
              &lt;li class="nav-item"&gt;
                  &lt;a class="nav-link" href="adminpanel.php"&gt;Admin Panel&lt;/a&gt;
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
      &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
      &lt;div class="container-fluid"&gt;
          &lt;div class="container"&gt;
              &lt;h1&gt;Update post&lt;/h1&gt;
              &lt;form method="post" action="update.php" &gt;
  
                  &lt;select name="delTitle" class="form-control"&gt;
                      &lt;?php foreach ($updatedcontent as $update) { ?&gt;
                      &lt;option&gt;&lt;?php echo $post['title'];  ?&gt;&lt;/option&gt;;
                      &lt;?php } ?&gt;
                  &lt;/select&gt;
  
                  &lt;br&gt;
                  &lt;input type="text" name="title" class="form-control" placeholder="New title" &gt;
                  &lt;br&gt;
                  &lt;textarea name="content" rows="5" cols="60"  class="form-control" placeholder="Enter post"&gt;&lt;/textarea&gt;
                  &lt;br&gt;
                  &lt;br&gt;
                  &lt;button type="submit" name="submit" class="btn btn-success"&gt;Update post&lt;/button&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  
   &lt;script&gt;
    document.write('&lt;script src="http://' + (location.host || 'localhost').split(':')[0] +
    ':35729/livereload.js?snipver=1"&gt;&lt;/' + 'script&gt;')
  &lt;/script&gt; enter code here
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>