edit.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. session_start();
  11. $a=0;
  12. include_once('tables_in.php');
  13. $main=new tables_in();
  14. $a=$main->create_table($_SESSION['id']);
  15. $b=$main->check_values($_POST);
  16. $a[0]['date_time_start']=substr($a[0]['date_time_start'],0,-3);
  17. $a[0]['date_time_end']=substr($a[0]['date_time_end'],0,-3);
  18. $_POST['id']=1;
  19. if($b==0 || $b==4)
  20. if(isset($_POST))
  21. $main->save_edits($_POST,$_SESSION['id']);
  22. ?>
  23. <html style="height:100%;">
  24. <body style="background-color: #AAAAAA; min-height:100%;">
  25. <div style="background-color:#FFFFFF; margin-left:10%; margin-right:10%; padding:3%; height:100%;">
  26. <a href="calender.php"> Вернуться к списку </a>
  27. <form action = "<?php $_PHP_SELF ?>" method="post">
  28. <table style="border: solid-black 1px;">
  29. <th>Редактировать задачу</th>
  30. <tr>
  31. <td><label for="theme"> Тема: </label></td>
  32. <td><input type="text" name ="theme" id="theme" value="<?php if (isset($_POST['theme']) and $_POST['theme']!='') echo $_POST['theme']; else echo $a[0]['theme']; ?>"></td>
  33. </tr>
  34. <tr>
  35. <td><label for="type"> Тип:</label></td>
  36. <td><input type="text" name ="type" id="type" value="<?php if (isset($_POST['type']) and $_POST['type']!='') echo $_POST['type']; else echo $a[0]['type']; ?>"></td>
  37. </tr>
  38. <tr>
  39. <td><label for="place"> Место:</label></td>
  40. <td><input type="text" name ="place" id="place" value="<?php if (isset($_POST['place']) and $_POST['place']!='') echo $_POST['place']; else echo $a[0]['place']; ?>"></td>
  41. </tr>
  42. <tr>
  43. <td><label for="date_start"> Дата начала:</label></td>
  44. <td><input type="date" name ="date_start" id="date_start" value="<?php if (isset($_POST['date_start']) and $_POST['date_start']!='') echo $_POST['date_start']; else echo substr($a[0]['date_time_start'],0,10); ?>"></td>
  45. </tr>
  46. <tr>
  47. <td><label for="time_start"> Время начала:</label></td>
  48. <td><input type="time" name ="time_start" id="time_start" value="<?php if (isset($_POST['time_start']) and $_POST['time_start']!='') echo $_POST['time_start']; else echo substr($a[0]['date_time_start'],11,8); ?>"></td>
  49. </tr>
  50. <tr>
  51. <td><label for="date_end"> Дата начала:</label></td>
  52. <td><input type="date" name ="date_end" id="date_end" value="<?php if (isset($_POST['date_end']) and $_POST['date_end']!='') echo $_POST['date_end']; else echo substr($a[0]['date_time_end'],0,10); ?>"></td>
  53. </tr>
  54. <tr>
  55. <td><label for="time_end"> Время начала:</label></td>
  56. <td><input type="time" name ="time_end" id="time_end" value="<?php if (isset($_POST['time_end']) and $_POST['time_end']!='') echo $_POST['time_end']; else echo substr($a[0]['date_time_end'],11,8); ?>"></td>
  57. </tr>
  58. <tr>
  59. <td>Направление</td><td><select name="status" value="<?php if (isset($_POST['status']) and $_POST['status']!='') echo $_POST['status']; else echo $a[0]['status']; ?>">
  60. <option value="done">done</option>
  61. <option value="undone">undone</option>
  62. </select>
  63. </tr>
  64. <tr>
  65. <td>Удалить?</td><td><select name="delete" value="<?php if (isset($_POST['delete']) and $_POST['delete']!='') echo $_POST['delete']; else echo $a[0]['delete']; ?>">
  66. <option value="no">ни в коем случае!</option>
  67. <option value="yes">обязательно!</option>
  68. </select>
  69. </tr>
  70. <tr>
  71. <td><label for="comment"> Комментарий:</label></td>
  72. <td><textarea rows="4" name ="comment" id="comment"><?php if (isset($_POST['comment']) and $_POST['comment']!='') echo $_POST['comment']; else echo $a[0]['comment']; ?></textarea></td>
  73. </tr>
  74. <tr>
  75. <td text-align:center colspan="2"><input type="submit" value="применить изменения" name="send"></td>
  76. </tr>
  77. <?php
  78. if($b==1)
  79. echo('Буффер пустой');
  80. if($b==2)
  81. echo('Заполните все поля');
  82. if($b==3)
  83. echo('Неверный формат даты');
  84. ?>
  85. </tr></td>
  86. </tr>
  87. </table>
  88. </form>
  89. </div>
  90. </body>
  91. </html>