title: Trying to add a delete button to PHP website
body: <p>I'm new to php and trying to add a delete button to remove an object (job) from a list,
  I want the delete button to appear beside each of the individual objects (jobs) and once clicked this job gets deleted from the database table. Below is the code for both my edit_jobs.php (displays all the jobs by a particular user) and the delete_job.php (suppose to remove that particular job from the table) Can somebody please tell me what I'm doing wrong, </p>
  
  <p>My edit_jobs page displays all the jobs in the table that particular user has posted.</p>
  
  <pre><code>&lt;?php
          include_once "connect_to_mysql.php";
          $id = $userid;
          $username = $_GET['username'];
  
  
          $result = mysql_query("SELECT * FROM jobs WHERE user_id ='$id'")
                  or die(mysql_error());
  
          while ($row = mysql_fetch_array($result)) {
              echo '&lt;a href="job.php?id=' . $row['job_id'] . '"&gt; ' . $row['job'] . '&lt;/a&gt;&lt;br /&gt;';
              echo 'category: ' . $row['category'] . '&lt;br /&gt;';
              echo 'description: ' . $row['description'] . '&lt;br /&gt;';
              echo '&lt;a href="member.php?id=' . $row['userid'] . '"&gt;Clients profile&lt;/a&gt;&lt;br /&gt;';
              echo '&lt;br /&gt;';?&gt;
          &lt;a href="delete_job.php?job_id=&lt;?php echo $row['job']; ?&gt;"
                         onclick="return confirm('Are you sure you want to delete this book?');"&gt;
                         &lt;img src="images/delete20.png" alt="Delete Book" /&gt;
                      &lt;/a&gt;
          &lt;?php } ?&gt;
  </code></pre>
  
  <p>The delete_job page </p>
  
  <pre><code>&lt;?php
  if ($_SERVER['REQUEST_METHOD'] == 'GET') {
  if (!empty($_GET['job_id'])) {
      $jobId = $_GET['job_id'];
  
      require_once 'connect_to_mysql.php';
  
      $sql = "DELETE FROM jobs WHERE job_id = ?";
  
      $params = array($jobId);
  
      $stmt = $link-&gt;prepare($sql);
      $status = $stmt-&gt;execute($params);
  
  
      if ($status == true) {
          header("Location: edit_jobs.php");
      }
      else {
          $error_info = $stmt-&gt;errorInfo();
          $error_message = "failed to delete job: {$error_info[2]} - error code {$error_info[0]}";
          require 'error.php';
      }
  }
  
  else {
      $error_message = "book id not specified";
      require 'edit_jobs.php';
  }
  }
  else {
  }
  ?&gt;
  </code></pre>