task.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <DOCTYPE html>
  2. <head>
  3. <meta http-equiv = "content-type" charset = utf-8" >
  4. <meta name = "description" content = "task_add" >
  5. <meta name = "keywords" content = "task_add">
  6. <title>php1</title>
  7. <link rel="stylesheet" type="text/css" href="style.css">
  8. </head>
  9. <?php
  10. $a=0;
  11. include_once('tables_in.php');
  12. $main=new tables_in();
  13. $a=$main->check_values($_POST);
  14. if($a==0)
  15. $main->add_task($_POST);
  16. ?>
  17. <html style="height:100%;">
  18. <body style="background-color: #AAAAAA; min-height:100%;">
  19. <div style="background-color:#FFFFFF; margin-left:10%; margin-right:10%; padding:3%; height:100%;">
  20. <a href="calender.php"> Вернуться к списку </a>
  21. <form action = "<?php $_PHP_SELF ?>" method="post">
  22. <table style="border: solid-black 1px;">
  23. <th>Новая задача</th>
  24. <tr>
  25. <td><label for="theme"> Тема: </label></td>
  26. <td><input type="text" name ="theme" id="theme" value="<?php if (isset($_POST['theme'])) { echo $_POST['theme']; } ?>"></td>
  27. </tr>
  28. <tr>
  29. <td><label for="type"> Тип:</label></td>
  30. <td><input type="text" name ="type" id="type" value="<?php if (isset($_POST['type'])) { echo $_POST['type']; } ?>"></td>
  31. </tr>
  32. <tr>
  33. <td><label for="place"> Место:</label></td>
  34. <td><input type="text" name ="place" id="place" value="<?php if (isset($_POST['place'])) { echo $_POST['place']; } ?>"></td>
  35. </tr>
  36. <tr>
  37. <td><label for="date_start"> Дата начала:</label></td>
  38. <td><input type="date" name ="date_start" id="date_start" value="<?php if (isset($_POST['date_start'])) { echo $_POST['date_start']; } ?>"></td>
  39. </tr>
  40. <tr>
  41. <td><label for="time_start"> Время начала:</label></td>
  42. <td><input type="time" name ="time_start" id="time_start" value="<?php if (isset($_POST['time_start'])) echo $_POST['time_start']; else echo('00:00'); ?>"></td>
  43. </tr>
  44. <tr>
  45. <td><label for="date_end"> Дата начала:</label></td>
  46. <td><input type="date" name ="date_end" id="date_end" value="<?php if (isset($_POST['date_end'])) { echo $_POST['date_end']; } ?>"></td>
  47. </tr>
  48. <tr>
  49. <td><label for="time_end"> Время начала:</label></td>
  50. <td><input type="time" name ="time_end" id="time_end" value="<?php if (isset($_POST['time_end'])) { echo $_POST['time_end']; } else echo('00:00'); ?>"></td>
  51. </tr>
  52. <tr>
  53. <tr>
  54. <td><label for="comment"> Комментарий:</label></td>
  55. <td><textarea rows="4" name ="comment" id="comment" value="<?php if (isset($_POST['comment'])) { echo $_POST['comment']; } ?>"></textarea></td>
  56. </tr>
  57. </tr>
  58. <tr>
  59. <td text-align:center colspan="2"><input type="submit" value="Send" name="send"></td>
  60. <tr><td>
  61. <?php
  62. if($a==1)
  63. echo('Ошибка ввода');
  64. if($a==2)
  65. echo('Заполните все поля');
  66. if($a==3)
  67. echo('Неверный формат даты');
  68. if($a==4)
  69. echo('Время занято');
  70. ?>
  71. </tr></td>
  72. </tr>
  73. </table>
  74. </form>
  75. </div>
  76. </body>
  77. </html>