This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 22nd, 2013  |  syntax: None  |  size: 2.36 KB  |  views: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. error_reporting(E_ALL);
  3. ini_set('display_errors', true);
  4. ?>
  5.  
  6. <?php
  7. $connection = mysql_connect("","","");
  8. if (!$connection) {
  9. die('PHP Mysql database connection could not connect : ' . mysql_error());
  10. }
  11. else{
  12. $db_name = "";
  13. mysql_select_db($db_name, $connection);
  14.  
  15. if(isset($_POST['submit'])){
  16. if($_POST['ref']!="" && $_POST['role']!="" && $_POST['contract']!="" && $_POST['location']!=""
  17. && $_POST['salary']!="" && $_POST['description']!="" && $_POST['addedby']!=""
  18. && $_POST['status']!=""){
  19.  
  20. $update_sql = "UPDATE sgrjobs SET ref='".$_POST['ref']."',
  21. role='".$_POST['role']."',
  22. contract='".$_POST['contract']."',
  23. location='".$_POST['location']."',
  24. salary='".$_POST['salary']."',
  25. description'".$_POST['description']."',
  26. addedby'".$_POST['addedby']."',
  27. status'".$_POST['status']."' WHERE id = '" . $_GET['id'] . "'";
  28. }
  29. }
  30. }
  31. ?>
  32.  
  33. <?php
  34. $title = "Admin Edit Page";
  35.  
  36. include ( 'includes/header.php' );
  37.  
  38. $q= mysql_query("SELECT ref, role FROM sgrjobs WHERE id='" . $_GET['id'] . "'") or die(mysql_error());
  39.  
  40. $r = mysql_fetch_array($q);
  41.  
  42. ?>
  43. </head>
  44. <body>
  45. <div id="container">
  46. <a href="index.php">Back to Jobs</a>
  47. <br><br>
  48. <form action="<?php echo $_SERVER['PHP_SELF'] . '?id=' . $_GET['id']; ?>" method="post">
  49.  
  50. <table>
  51. <tr>
  52. <td>Job Ref : </td>
  53. <td><input type="text" name="ref" value="<?php echo $r['ref']; ?>" /></td>
  54. <td></td>
  55. </tr>
  56. <tr>
  57. <td>Job Role : </td>
  58. <td><input type="text" name="role" value="<?php echo $r['role']; ?>" /></td>
  59. <td></td>
  60. </tr>
  61. <tr>
  62. <td>Contract : </td>
  63. <td><select name="contract" />
  64. <option value="Temporary">Temporary</option>
  65. <option value="Permenant">Permenant</option>
  66. </select>
  67. </td>
  68. <td></td>
  69. </tr>
  70. <tr>
  71. <td>Location : </td>
  72. <td><input type="text" name="location" /></td>
  73. <td></td>
  74. </tr>
  75. <tr>
  76. <td>Salary : </td>
  77. <td><input type="text" name="salary" /></td>
  78. <td></td>
  79. </tr>
  80. <tr>
  81. <td>Description : </td>
  82. <td><textarea name="description" cols="30" rows="6" /></textarea></td>
  83. <td></td>
  84. </tr>
  85. <tr>
  86. <td>Added By : </td>
  87. <td><input type="text" name="addedby" /></td>
  88. <td></td>
  89. </tr>
  90. <tr>
  91. <td>Status : </td>
  92. <td>Active<input type="radio" name="status" value="active" />
  93. Inactive<input type="radio" name="status" value="inactive" /></td>
  94. <td></td>
  95. </tr>
  96. <tr>
  97. <td></td>
  98. <td><input type="submit" name='submit' value="Submit"/></td>
  99. <td></td>
  100. </tr>
  101. </table>
  102. </form>
  103. </div>
  104. </body>
  105. </html>
clone this paste RAW Paste Data