} else { $image = 'img_bbdd/helados.jpg'; $directory = "img_bbdd/helados.jpg"; } } switch ($_REQUEST['action']) { case 'update': /*echo "<script type=\"text/javascript\"> alert('¡El registro se ha actualizado exitosamente! El directorio de la imagen es: $directory'); //history.go(-2); </script>";*/ $answer->__SET('id_answer', $_REQUEST['id_answer']); $answer->__SET('id_event', $_REQUEST['id_event']); $answer->__SET('respuesta', $_REQUEST['respuesta']); $answer->__SET('correct', $_REQUEST['correct']); $answerModel->Update($answer); echo "<script type=\"text/javascript\">\n alert('¡El registro se ha actualizado exitosamente! El directorio de la imagen es: {$directory}');\n history.go(-2);\n </script>"; break; case 'insert': //$answer->__SET('id_answer' , $_REQUEST['id_answer']); $answer->__SET('id_event', $_REQUEST['id_event']); $answer->__SET('respuesta', $_REQUEST['respuesta']); $answer->__SET('correct', $_REQUEST['correct']); $answerModel->Insert($answer); echo "<script type=\"text/javascript\">\n alert('Se ha añadido correctamente a la base de datos una respuesta');\n history.go(-2);\n </script>"; break; case 'edit': $answer = $answerModel->Obtain($_REQUEST['id_answer']); break; default: $error = "Error with the request action";