Add school and t-shirt size selection to each student

Update required fields for students to include: dateofbirth, schools_id, tshirt
This commit is contained in:
james 2004-12-08 20:18:36 +00:00
parent 8326b10958
commit 44473f264b
2 changed files with 35 additions and 25 deletions

View File

@ -30,7 +30,7 @@ function outputStatus($status)
function studentStatus()
{
global $config;
$required_fields=array("firstname","lastname","address","city","postalcode","phone","email","grade");
$required_fields=array("firstname","lastname","address","city","postalcode","phone","email","grade","dateofbirth","schools_id","tshirt");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");

View File

@ -46,7 +46,7 @@ if($_POST['action']=="save")
{
//INSERT new record
$dob=$_POST['year'][$x]."-".$_POST['month'][$x]."-".$_POST['day'][$x];
mysql_query("INSERT INTO students (registrations_id,firstname,lastname,email,address,city,province,postalcode,phone,dateofbirth,grade,year) VALUES (".
mysql_query("INSERT INTO students (registrations_id,firstname,lastname,email,address,city,province,postalcode,phone,dateofbirth,grade,schools_id,tshirt,year) VALUES (".
"'".$_SESSION['registration_id']."', ".
"'".mysql_escape_string(stripslashes($_POST['firstname'][$x]))."', ".
"'".mysql_escape_string(stripslashes($_POST['lastname'][$x]))."', ".
@ -58,6 +58,8 @@ if($_POST['action']=="save")
"'".mysql_escape_string(stripslashes($_POST['phone'][$x]))."', ".
"'$dob', ".
"'".mysql_escape_string(stripslashes($_POST['grade'][$x]))."', ".
"'".mysql_escape_string(stripslashes($_POST['schools_id'][$x]))."', ".
"'".mysql_escape_string(stripslashes($_POST['tshirt'][$x]))."', ".
"'".$config['FAIRYEAR']."')");
echo mysql_error();
@ -78,7 +80,9 @@ echo mysql_error();
"postalcode='".mysql_escape_string(stripslashes($_POST['postalcode'][$x]))."', ".
"phone='".mysql_escape_string(stripslashes($_POST['phone'][$x]))."', ".
"dateofbirth='$dob', ".
"grade='".mysql_escape_string(stripslashes($_POST['grade'][$x]))."' ".
"grade='".mysql_escape_string(stripslashes($_POST['grade'][$x]))."', ".
"schools_id='".mysql_escape_string(stripslashes($_POST['schools_id'][$x]))."', ".
"tshirt='".mysql_escape_string(stripslashes($_POST['tshirt'][$x]))."' ".
"WHERE id='".$_POST['id'][$x]."'");
echo notice(i18n("%1 %2 successfully updated",array($_POST['firstname'][$x],$_POST['lastname'][$x])));
@ -164,11 +168,11 @@ if($_GET['action']=="removestudent")
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Email Address")."</td><td><input type=\"text\" name=\"email[$x]\" value=\"$studentinfo->email\" /></td>\n";
echo " <td>".i18n("Province")."</td><td><input type=\"text\" name=\"province[$x]\" value=\"$studentinfo->province\" /></td>\n";
echo " <td>".i18n("City")."</td><td><input type=\"text\" name=\"city[$x]\" value=\"$studentinfo->city\" /></td>\n";
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("City")."</td><td><input type=\"text\" name=\"city[$x]\" value=\"$studentinfo->city\" /></td>\n";
echo " <td>".i18n("Province")."</td><td><input type=\"text\" name=\"province[$x]\" value=\"$studentinfo->province\" /></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";
@ -200,31 +204,37 @@ if($_GET['action']=="removestudent")
echo "</select>\n";
echo " </td>";
echo "</tr>";
/*
echo "<tr>\n";
echo " <td>".i18n("School")."</td><td>";
$q=mysql_query("SELECT id,school FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER by school");
echo "<select name=\"schools_id[$x]\">\n";
echo "<option value=\"\">".i18n("Choose School")."</option>\n";
while($r=mysql_fetch_object($q))
{
if($studentinfo->schools_id==$r->id) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$r->id\">".htmlspecialchars($r->school)."</option>\n";
</td>
</tr>
<tr>
<td align=right><? echo i18n("tshirtsize"); ?></td>
<td><select name=tshirt1>
<option value="small"><? echo i18n("small"); ?></option>
<option value="medium"><? echo i18n("medium"); ?></option>
<option value="large"><? echo i18n("large"); ?></option>
<option value="xlarge"><? echo i18n("xlarge"); ?></option>
</select>
</td>
<td align=right><? echo i18n("emailaddress"); ?></td>
<td><input type=text name=emailaddress1></td>
</tr>
</table>
}
echo "</select>";
echo "</td>\n";
echo " <td>".i18n("T-Shirt Size")."</td><td>";
echo " <select name=\"tshirt[$x]\">\n";
if($studentinfo->tshirt=="small") $sel="selected=\"selected\""; else $sel="";
echo " <option $sel value=\"small\">".i18n("Small")."</option>";
if($studentinfo->tshirt=="medium") $sel="selected=\"selected\""; else $sel="";
echo " <option $sel value=\"medium\">".i18n("Medium")."</option>";
if($studentinfo->tshirt=="large") $sel="selected=\"selected\""; else $sel="";
echo " <option $sel value=\"large\">".i18n("Large")."</option>";
if($studentinfo->tshirt=="xlarge") $sel="selected=\"selected\""; else $sel="";
echo " <option $sel value=\"xlarge\">".i18n("X-Large")."</option>";
echo " </select>";
echo "<tr><td>".i18n("Name").": </td><td><input type=\"text\" name=\"name$x\" value=\"$studentinfo->name\"></td></tr>";
*/
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
if($numfound>$config['minstudentsperproject'] && $studentinfo->id)
{
echo "<div align=\"right\"><a onclick=\"return confirmClick('".i18n("Are you sure you want to remove this student from the project?")."');\" class=\"caution\" href=\"register_participants_students.php?action=removestudent&amp;removestudent=$studentinfo->id\">".i18n("Remove this student from project")."</a></div>";