Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. var fecha_inicio = $("#modalEvento #fecha_inicio").val();
  2. var hora_inicio = $("#modalEvento #hora_inicio").val();
  3. var fecha_fin = $("#modalEvento #fecha_fin").val();
  4. var hora_fin = $("#modalEvento #hora_fin").val();
  5. start = fecha_inicio + " "+ hora_inicio;
  6. end = fecha_fin + " " + hora_fin;
  7. $.ajax({
  8. url:"incld/insert.php",
  9. type:"POST",
  10. data:{
  11. title:nombre,
  12. start:start,
  13. end:end
  14. },
  15. success:function(){
  16. $("#modalEvento").modal('hide');
  17. var calendar = $('#calendar').fullCalendar();
  18. calendar.fullCalendar('refetchEvents');
  19. swal("Evento Agregado !!", "", "success");
  20. }
  21. })
  22.  
  23. <div class="row">
  24. <div class="col-md-6">
  25. <div class="form-group">
  26. <label>Fecha de Inicio</label>
  27. <input type="date" name="fecha_inicio" id="fecha_inicio" class="form-control" >
  28. </div>
  29. </div>
  30. <div class="col-md-6">
  31. <div class="form-group">
  32. <label>Hora de Inicio</label>
  33. <input type="time" name="hora_inicio" id="hora_inicio" class="form-control">
  34. </div>
  35. </div>
  36. </div>
  37. <div class="row">
  38. <div class="col-md-6">
  39. <div class="form-group">
  40. <label>Fecha Finalización</label>
  41. <input type="date" name="fecha_fin" id="fecha_fin" class="form-control">
  42. </div>
  43. </div>
  44. <div class="col-md-6">
  45. <div class="form-group">
  46. <label>Hora de Finalización</label>
  47. <input type="time" name="hora_fin" id="hora_fin" class="form-control" required="">
  48. </div>
  49. </div>
  50. </div>
  51.  
  52. $connect = new PDO('mysql:host=localhost;dbname=agenda', 'dbmasteruser', 'enjoyprocess23');
  53. $query = "
  54. INSERT INTO event
  55. (title, start_event, end_event)
  56. VALUES (:title, :start_event, :end_event)
  57. ";
  58. $statement = $connect->prepare($query);
  59. $statement->execute(
  60. array(
  61. ':title' => $_POST['title'],
  62. ':start_event' => $_POST['start'],
  63. ':end_event' => $_POST['end']
  64. )
  65. );
  66.  
  67. start: 2019-04-30+10:30
  68. end: 2019-04-30+11:30
  69.  
  70. start: 2019-04-30 05:30:00
  71. end: 2019-04-30 06:30:00
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement