Нет описания

insertQuestionnaireExperience.php 1.2KB

1234567891011121314151617181920212223242526272829303132
  1. <!---
  2. Developer: Coralys Cubero Rivera
  3. Fall 2018
  4. This file contains the function that allows us to associate a questionnaire that already exists,
  5. to a particular experience.
  6. Updated by: Víctor A. Hernández
  7. Summer 2019
  8. --->
  9. <?php
  10. require_once 'processes/config.php';
  11. require_once 'processes/dbh.inc.php';
  12. // IF USER ENTERS PAGE AFTER SUBMIT BUTTON HAS BEEN PRESSED (FROM viewExperience.php), ADD QUESTIONNAIRE TO EXPERIENCE
  13. // ELSE DO NOTHING
  14. // WARNING: ESTO NO PROVEE PROTECCIÓN POR SI EL VALOR DEL SELECT ES '' (CUESTIONARIO INVÁLIDO) O SI YA HAY UN CUESTIONARIO REPETIDO
  15. if(isset($_POST['submitQuestionnaireQuestion'])) {
  16. $query = "INSERT INTO `experience_questionnair` (`id_experience`, `id_questionnair`) VALUES ('".$_POST['id_experience']."', '".$_POST['questionnaire']."');";
  17. if(!mysqli_query($connection, $query)) die("Error: ".mysqli_error($connection));
  18. // WHY NOT USE header INSTEAD OF window.top.location?
  19. //header('Location: http://emaapp.online/admin_nuevo/viewExperience.php?='.$_POST['id_experience']);
  20. //exit();
  21. echo "<script>window.top.location='http://emaapp.online/admin_nuevo/viewExperience.php?view=".$_POST['id_experience']."'</script>";
  22. }