Guest User

Add Cat

a guest
Feb 25th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. doAddC.php
  2. <?php
  3. include('includes/functions.php');
  4. if(isset($_POST['submit'])){
  5. if(isset($_POST['CatName'])){
  6. addCat($_POST['CatName'], $_POST['Desc']);
  7. header('Location: cat.php');
  8. }else{
  9. echo"Molimo unesite ime kategorije!";
  10. include('addCat.php');
  11. }
  12. }else{
  13. header("Location: addCat.php");
  14. }
  15. ?>
  16.  
  17. cat.php
  18. <?php
  19. include('includes/functions.php');
  20. ?>
  21. <html>
  22. <head>
  23. <title>Ante's CMS</title>
  24.  
  25. </head>
  26. <body>
  27. <?php
  28. session_start();
  29. if (isset($_SESSION['user'])) {
  30. ?>
  31.  
  32.  
  33. <h4><a href="index.php">Idi na glavni menu</a></h4>
  34. <h4><a href="addCat.php">Dodaj novu kategoriju</a></h4><br>
  35.  
  36. <table cellspacing="0" cellpadding="10">
  37. <thead>
  38. <tr>
  39. <td> Ime clanka:</td>
  40. <td>Opis tutorijala:</td>
  41. <td>Action:</td>
  42. </tr>
  43. </thead>
  44. <tbody>
  45. <?php
  46. getcats();
  47. ?>
  48. </tbody>
  49. </table>
  50.  
  51. <?php
  52.  
  53. } else{
  54. header("Location: login.php");
  55. }
  56.  
  57. ?>
  58. </body>
  59. </html>
  60.  
  61. addCat.php
  62. <html>
  63. <head>
  64. <title>Johnny's CMS</title>
  65.  
  66. </head>
  67. <body>
  68. <h2>Dodaj kategoriju</h2>
  69. <form action="doAddC.php" method="POST">
  70. <table>
  71. <tr>
  72. <td><label for="CatName">Name</label></td><td><input type="text" name="CatName"/></td>
  73.  
  74.  
  75. </tr>
  76. <td><label for="CatDesc">Opis</label></td><td><input type="text" name="Desc"/></td>
  77. <tr>
  78. <td>
  79. <colspan="2"><input type="submit" name="submit"/>
  80. </tr>
  81.  
  82. </tr>
  83. </form>
  84. <a href="Cat.php">Vrati se!</a><br><br>
  85. </body>
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment