add a province selector

switch student registration to use province selector
This commit is contained in:
james 2005-01-05 16:23:11 +00:00
parent 2b65a62239
commit 726f466ac1
2 changed files with 27 additions and 1 deletions

View File

@ -295,6 +295,30 @@ function emit_year_selector($name,$selected="",$min=0,$max=0)
echo "</select>\n";
}
function emit_province_selector($name,$selected="")
{
$q=mysql_query("SELECT * FROM provinces ORDER BY province");
if(mysql_num_rows($q)==1)
{
$r=mysql_fetch_object($q);
echo "<input type=\"hidden\" name=\"$name\" value=\"$r-code\">";
echo i18n($r->province);
}
else
{
echo "<select name=\"$name\">\n";
echo "<option value=\"\">".i18n("Province")."</option>\n";
while($r=mysql_fetch_object($q))
{
if($r->code == $selected) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$r->code\">".i18n($r->province)."</option>\n";
}
echo "</select>\n";
}
}
function outputStatus($status)

View File

@ -219,7 +219,9 @@ else if($newstatus=="complete")
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Address")."</td><td><input type=\"text\" name=\"address[$x]\" value=\"$studentinfo->address\" /></td>\n";
echo " <td>".i18n("Province")."</td><td><input type=\"text\" name=\"province[$x]\" value=\"$studentinfo->province\" /></td>\n";
echo " <td>".i18n("Province")."</td><td>";
emit_province_selector("province[$x]",$studentinfo->province);
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Postal Code")."</td><td><input type=\"text\" name=\"postalcode[$x]\" value=\"$studentinfo->postalcode\" /></td>\n";