Implement Bug #0000011 - Show safety question order and warnings when non-numeric values entered

This commit is contained in:
james 2006-10-15 19:50:09 +00:00
parent 9eef488a5d
commit ac3e1d6b1d

View File

@ -31,6 +31,9 @@
{ {
if($_POST['question']) if($_POST['question'])
{ {
if(!ereg("^[0-9]*$",$_POST['ord']))
echo notice(i18n("Defaulting non-numeric order value %1 to 0",array($_POST['ord'])));
mysql_query("UPDATE safetyquestions SET 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']))."',
@ -137,10 +140,12 @@
echo "<table class=\"summarytable\">"; echo "<table class=\"summarytable\">";
$q=mysql_query("SELECT * FROM safetyquestions WHERE year='".$config['FAIRYEAR']."' ORDER BY ord"); $q=mysql_query("SELECT * FROM safetyquestions WHERE year='".$config['FAIRYEAR']."' ORDER BY ord");
echo "<tr><th>".i18n("Question")."</th><th>".i18n("Type")."</th><th>".i18n("Required")."</th><th>".i18n("Actions")."</th></tr>"; echo "<tr><th>".i18n("Ord")."</th><th>".i18n("Question")."</th><th>".i18n("Type")."</th><th>".i18n("Required")."</th><th>".i18n("Actions")."</th></tr>";
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
{ {
echo "<tr><td>$r->question</td>"; echo "<tr>";
echo "<td>$r->ord</td>";
echo "<td>$r->question</td>";
echo "<td align=\"center\">$r->type</td>"; echo "<td align=\"center\">$r->type</td>";
echo "<td align=\"center\">$r->required</td>"; echo "<td align=\"center\">$r->required</td>";
echo "<td align=\"center\">"; echo "<td align=\"center\">";