Add some instructions to the safety questions page, and properly detect if there are no questions

This commit is contained in:
james 2006-02-01 17:50:27 +00:00
parent ab294df97b
commit b63674f649

View File

@ -102,9 +102,6 @@ else if($newstatus=="complete")
}
echo "<form method=\"post\" action=\"register_participants_safety.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
echo "<table>\n";
$q=mysql_query("SELECT * FROM safety WHERE registrations_id='".$_SESSION['registration_id']."'");
while($r=mysql_fetch_object($q))
@ -113,38 +110,49 @@ else if($newstatus=="complete")
}
$q=mysql_query("SELECT * FROM safetyquestions WHERE year='".$config['FAIRYEAR']."' ORDER BY ord");
$num=1;
while($r=mysql_fetch_object($q))
if(mysql_num_rows($q))
{
echo "<tr><td><b>$num</b>. </td><td>";
if($r->required=="yes") echo REQUIREDFIELD;
echo i18n($r->question)."</td>";
echo "<td>";
if($r->type=="check")
{
if($safetyanswers[$r->id]=="checked") $ch="checked=\"checked\""; else $ch="";
echo "<input $ch type=\"checkbox\" name=\"safety[$r->id]\" value=\"checked\" />";
}
else if($r->type=="yesno")
{
echo "<nobr>";
if($safetyanswers[$r->id]=="yes") $ch="checked=\"checked\""; else $ch="";
echo "<input $ch type=\"radio\" name=\"safety[$r->id]\" value=\"yes\" />";
echo i18n("Yes");
echo "</nobr><br /><nobr>";
if($safetyanswers[$r->id]=="no") $ch="checked=\"checked\""; else $ch="";
echo "<input $ch type=\"radio\" name=\"safety[$r->id]\" value=\"no\" />";
echo i18n("No");
echo "</nobr>";
}
echo "</td>";
echo "</tr>";
$num++;
}
echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Save Safety Information")."\" />\n";
echo "</form>";
echo i18n("Please agree to / answer the following safety questions by checking the box next to the question, or choosing the appropriate answer");
echo "<br />";
echo "<br />";
echo "<form method=\"post\" action=\"register_participants_safety.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
echo "<table>\n";
$num=1;
while($r=mysql_fetch_object($q))
{
echo "<tr><td><b>$num</b>. </td><td>";
if($r->required=="yes") echo REQUIREDFIELD;
echo i18n($r->question)."</td>";
echo "<td>";
if($r->type=="check")
{
if($safetyanswers[$r->id]=="checked") $ch="checked=\"checked\""; else $ch="";
echo "<input $ch type=\"checkbox\" name=\"safety[$r->id]\" value=\"checked\" />";
}
else if($r->type=="yesno")
{
echo "<nobr>";
if($safetyanswers[$r->id]=="yes") $ch="checked=\"checked\""; else $ch="";
echo "<input $ch type=\"radio\" name=\"safety[$r->id]\" value=\"yes\" />";
echo i18n("Yes");
echo "</nobr><br /><nobr>";
if($safetyanswers[$r->id]=="no") $ch="checked=\"checked\""; else $ch="";
echo "<input $ch type=\"radio\" name=\"safety[$r->id]\" value=\"no\" />";
echo i18n("No");
echo "</nobr>";
}
echo "</td>";
echo "</tr>";
$num++;
}
echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Save Safety Information")."\" />\n";
echo "</form>";
}
else
echo notice(i18n("There are no safety questions to be answered"));
send_footer();
?>