1. <?php
  2.  
  3. $title = "Job Role Description";
  4.  
  5. include ( 'includes/header.php' );
  6.  
  7. ?>
  8. </head>
  9. <body>
  10. <div id="container">
  11.  
  12. <?php
  13. /*
  14. VIEW.PHP
  15. Displays all data from 'jobs' table
  16. */
  17.  
  18. // connect to the database
  19. include('connect-db.php');
  20.  
  21. // get results from database
  22. $result = mysql_query("SELECT ID, ref, role, division, location, salary, description FROM jobs WHERE division='IT' ORDER BY id DESC")
  23. or die(mysql_error());
  24.  
  25. $id = '';
  26. if(isset($_POST['ID'])){ $id = $_POST['ID']; }
  27.  
  28. // display data in table
  29.  
  30. // loop through results of database query, displaying them in the table
  31. while($row = mysql_fetch_array( $result )) {
  32.  
  33. // echo out the contents of each row into a table
  34. echo "<table border='1' cellpadding='10' class='jobpagetable'>";
  35. echo "<tr><th class='jobpage'>Ref</th><td>". $row['ref'] . "</td></tr>";
  36. echo '<tr></tr><tr></tr>';
  37. echo "<tr><th class='jobs'>Role</th><td>" . $row['role'] . '</td></tr>';
  38. echo '<tr></tr><tr></tr>';
  39. echo "<tr><th class='jobs'>Division</th><td>" . $row['division'] . '</td></tr>';
  40. echo '<tr></tr><tr></tr>';
  41. echo "<tr><th class='jobs'>Location</th><td>" . $row['location'] . '</td></tr>';
  42. echo '<tr></tr><tr></tr>';
  43. echo "<tr><th class='jobs'>Salary</th><td>" . $row['salary'] . '</td></tr>';
  44. echo '<tr></tr><tr></tr>';
  45. echo "<tr><th class='jobs'>Description</th><td>" . $row['description'] . '</td></tr>';
  46. echo '<tr></tr><tr></tr>';
  47. echo "<td><a class='applylinks' href='apply.php?id=" .$row['ID']."'>Apply</a></td>";
  48. echo "</tr>";
  49. }
  50. // close table>
  51. echo "</table>";
  52. ?>
  53.  
  54. </div>
  55. </body>
  56. </html>