Guest User

Untitled

a guest
Jul 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script>
  4. $( function() {
  5. $( "#datepicker" ).datepicker();
  6. } );
  7. </script>
  8. </head>
  9. <body>
  10. </body>
  11. </html>
  12.  
  13. <?php
  14. if (isset($_POST['submit']) && $_POST['submit']=="invia")
  15. {
  16. $titolo = addslashes($_POST['titolo']);
  17. $testo = addslashes($_POST['testo']);
  18. $str_data = strtotime($_POST['data']);
  19. include 'config.php';
  20. $sql = "INSERT INTO appuntamenti (titolo,testo,str_data ) VALUES ('$titolo', '$testo', '$str_data')";
  21. if($result = pg_query($sql))
  22. {
  23. echo "Inserimento avvenuto con successo.<br>
  24. Vai al <a href="index.php">Calendario</a>";
  25. }
  26. }else{
  27. ?>
  28.  
  29. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  30. Titolo:<br>
  31. <input name="titolo" type="text"><br>
  32. Testo:<br>
  33. <textarea name="testo" cols="30" rows="8"></textarea><br>
  34. Date:<br>
  35. <input name="datepicker" type="text" ><br>
  36. Time:<br>
  37. <input name="hour" type="time" ><br>
  38. <input name="submit" type="submit" value="invia">
  39. </form>
  40. </body>
  41.  
  42. <?php
  43. }
  44. ?>
  45.  
  46. <html>
  47. <head>
  48. <script>
  49. $(function() {
  50. $("#datepicker").datepicker();
  51.  
  52. $('.timepicker').timepicker({
  53. timeFormat: 'h:mm p',
  54. interval: 60,
  55. minTime: '8',
  56. maxTime: '08:00pm',
  57. defaultTime: '11',
  58. startTime: '08:00',
  59. dynamic: false,
  60. dropdown: true,
  61. scrollbar: true
  62. });
  63.  
  64.  
  65. });
  66. </script>
  67.  
  68. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  69. <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  70. <link rel="stylesheet" href="/resources/demos/style.css">
  71. <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  72. <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  73. <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.css">
  74. <script src="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js"></script>
  75.  
  76.  
  77. </head>
  78. <body>
  79. </body>
  80. </html>
  81.  
  82. <?php
  83. if (isset($_POST['submit']) && $_POST['submit']=="invia")
  84. {
  85. $titolo = addslashes($_POST['titolo']);
  86. $testo = addslashes($_POST['testo']);
  87. $str_data = strtotime($_POST['data']);
  88. include 'config.php';
  89. $sql = "INSERT INTO appuntamenti (titolo,testo,str_data ) VALUES ('$titolo', '$testo', '$str_data')";
  90. if($result = pg_query($sql))
  91. {
  92. echo "Inserimento avvenuto con successo.<br>
  93. Vai al <a href="index.php">Calendario</a>";
  94. }
  95. }else{
  96. ?>
  97.  
  98. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  99. Titolo:<br>
  100. <input name="titolo" type="text"><br>
  101. Testo:<br>
  102. <textarea name="testo" cols="30" rows="8"></textarea><br>
  103. <!--Data:<br>
  104. <input name="datepicker" type="text" ><br>
  105. Orario:<br>
  106. <input name="hour" type="time" ><br>
  107. -->
  108.  
  109.  
  110. Date:<br>
  111. <input name="datepicker" id="datepicker" type="text"><br> Orario:
  112. <br>
  113. <input name="hour" type="text" class="timepicker"><br>
  114.  
  115.  
  116.  
  117. <input name="submit" type="submit" value="invia">
  118. </form>
  119. </body>
  120.  
  121. <?php
  122. }
  123. ?>
Add Comment
Please, Sign In to add comment