Make safety questions require a question to be filled in (or at least something in the question box)

This commit is contained in:
james 2006-02-01 16:59:45 +00:00
parent b9bf8fba6c
commit ab294df97b

View File

@ -29,7 +29,9 @@
if($_POST['action']=="save" && $_POST['save']) 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']))."', question='".mysql_escape_string(stripslashes($_POST['question']))."',
`type`='".mysql_escape_string(stripslashes($_POST['type']))."', `type`='".mysql_escape_string(stripslashes($_POST['type']))."',
`required`='".mysql_escape_string(stripslashes($_POST['required']))."', `required`='".mysql_escape_string(stripslashes($_POST['required']))."',
@ -37,23 +39,29 @@
WHERE id='".$_POST['save']."' AND year='".$config['FAIRYEAR']."'"); WHERE id='".$_POST['save']."' AND year='".$config['FAIRYEAR']."'");
echo mysql_error(); 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") if($_POST['action']=="new")
{ {
mysql_query("INSERT INTO safetyquestions (question,type,required,ord,year) VALUES ( if($_POST['question'])
'".mysql_escape_string(stripslashes($_POST['question']))."', {
'".mysql_escape_string(stripslashes($_POST['type']))."', mysql_query("INSERT INTO safetyquestions (question,type,required,ord,year) VALUES (
'".mysql_escape_string(stripslashes($_POST['required']))."', '".mysql_escape_string(stripslashes($_POST['question']))."',
'".mysql_escape_string(stripslashes($_POST['ord']))."', '".mysql_escape_string(stripslashes($_POST['type']))."',
'".$config['FAIRYEAR']."' '".mysql_escape_string(stripslashes($_POST['required']))."',
)"); '".mysql_escape_string(stripslashes($_POST['ord']))."',
echo mysql_error(); '".$config['FAIRYEAR']."'
)");
echo happy(i18n("Safety question successfully added")); echo mysql_error();
echo happy(i18n("Safety question successfully added"));
}
else
echo error(i18n("Question is required"));
} }
if($_GET['action']=="remove" && $_GET['remove']) if($_GET['action']=="remove" && $_GET['remove'])