diff --git a/config/safetyquestions.php b/config/safetyquestions.php index cdfbbdf9..b4bf79de 100644 --- a/config/safetyquestions.php +++ b/config/safetyquestions.php @@ -29,7 +29,9 @@ if($_POST['action']=="save" && $_POST['save']) { - mysql_query("UPDATE safetyquestions SET + if($_POST['question']) + { + mysql_query("UPDATE safetyquestions SET question='".mysql_escape_string(stripslashes($_POST['question']))."', `type`='".mysql_escape_string(stripslashes($_POST['type']))."', `required`='".mysql_escape_string(stripslashes($_POST['required']))."', @@ -37,23 +39,29 @@ WHERE id='".$_POST['save']."' AND year='".$config['FAIRYEAR']."'"); echo mysql_error(); - echo happy(i18n("Safety question successfully saved")); - + echo happy(i18n("Safety question successfully saved")); + } + else + echo error(i18n("Question is required")); } + if($_POST['action']=="new") { - mysql_query("INSERT INTO safetyquestions (question,type,required,ord,year) VALUES ( - '".mysql_escape_string(stripslashes($_POST['question']))."', - '".mysql_escape_string(stripslashes($_POST['type']))."', - '".mysql_escape_string(stripslashes($_POST['required']))."', - '".mysql_escape_string(stripslashes($_POST['ord']))."', - '".$config['FAIRYEAR']."' - )"); - echo mysql_error(); - - echo happy(i18n("Safety question successfully added")); - + if($_POST['question']) + { + mysql_query("INSERT INTO safetyquestions (question,type,required,ord,year) VALUES ( + '".mysql_escape_string(stripslashes($_POST['question']))."', + '".mysql_escape_string(stripslashes($_POST['type']))."', + '".mysql_escape_string(stripslashes($_POST['required']))."', + '".mysql_escape_string(stripslashes($_POST['ord']))."', + '".$config['FAIRYEAR']."' + )"); + echo mysql_error(); + echo happy(i18n("Safety question successfully added")); + } + else + echo error(i18n("Question is required")); } if($_GET['action']=="remove" && $_GET['remove'])