Hi to all Webmaster!
I have discover this problem when I inserted the scores of the students i a centain subject.
I am making a school project with regards to saving students' record.
first, I have to view all students under the certain subject and at the last field, I putted a form to put the scores of each student.
say '<input type=text name='score' size=10>' and number of '<input type=text>' is equal to the number of students.
I use the primary key of the students(IdNo) to be inserted at in the first field of the table(studScore ).
this is the problem, i want to insert the score of each student from the '<input>' in the second field of the said table.
I am thinking that maybe it deals with array, but i really don't know how to formulate it.
The solution to this problem would be my key in finishing this project.
Anyone?
Thanks in advance.
God Speed!
heres my sample code:
////ADDING SCORE
$addscore=$_GET['score'];
if($addscore){
?>
<table border=1 bgcolor=#E7EBED width=829>
<form action='<? PHP_SELF; ?>' method=post>
<tr align=center>
<td colspan=8><font face="Tahoma" size="2" color=00000><b> Result/s</b></font> </td>
</tr>
<tr align=center>
<td colspan=8>  ;</td>
</tr>
<?
}
$control=$_GET['subControl'];
$result = mysql_query( "SELECT students.IDNO,s tudents.FIRSTNA ME,students.LAS TNAME,students. MI,students.GEN DER,students.CO URSE,students.Y EAR FROM students,subjec ts,subjecttrans WHERE subjects.SUB_CO NTROL=subjecttr ans.SUBCONTROL AND subjecttrans.SU BCONTROL='$cont rol' AND subjecttrans.ID NO=students.IDN O ORDER BY students.LASTNA ME" ) or die ("SELECT Error: ".mysql_error() );
$num_rows=mysql _num_rows($resu lt);
//start if
if($num_rows > 0){
?>
<tr>
<th><font face="Tahoma" size="2" color=CC3300><b >Id No.</b></font> </th>
<th align=center><f ont face="Tahoma" size="2" color=CC3300>St udents' Name</b></font> </th>
<th><font face="Tahoma" size="2" color=CC3300>Ge nder</b></font> </th>
<th><font face="Tahoma" size="2" color=CC3300>Co urse</b></font> </th>
<th><font face="Tahoma" size="2" color=CC3300>Ye ar</b></font> </th>
<th><font face="Tahoma" size="2" color=CC3300>Ad d Score</b></font> </th>
</tr>
<tr align=center>
<td colspan=8>  ;</td>
</tr>
<form action="<? PHP_SELF; ?>" method=post>
<? $i=0;
while ($i < $num_rows) {
?>
<tr height=15 class=off onmouseover="th is.className='o n'" onmouseout="thi s.className='of f'">
<?
$id=mysql_resul t($result,$i,"I DNO");
$fn=mysql_resul t($result,$i,"F IRSTNAME");
$ln=mysql_resul t($result,$i,"L ASTNAME");
$mi=mysql_resul t($result,$i,"M I");
$gen=mysql_resu lt($result,$i," GENDER");
$cors=mysql_res ult($result,$i, "COURSE");
$yer=mysql_resu lt($result,$i," YEAR");
?>
<td> <fo nt face="Tahoma" size="2" color=666622><? echo $id; ?></font></td>
<td align=left>&nbs p;<font face="Tahoma" size="2" color=666622><? echo strtoupper($ln. ","." ".$fn." ".$mi); ?> </font> </td>
<td> <fo nt face="Tahoma" size="2" color=666622><? echo substr($gen,0,1 ); ?></font></td>
<td> <fo nt face="Tahoma" size="2" color=666622><? echo strtoupper($cor s); ?></font></td>
<td> <fo nt face="Tahoma" size="2" color=666622><? echo strtoupper($yer ); ?></font></td>
<-----this is the '<input>' i've tried to explain----->
<td> <fo nt face="Tahoma" size="2" color=666622><i nput name="score" type="text"></td>
<?
$i++;
}
?>
</tr>
<tr height=20>
<td colspan=8 align=center>&n bsp;<font face="Tahoma" color=666666 size="2">****No thing Follows****</font></td>
</tr>
<tr>
<td align=right>&nb sp;</td>
<td align=right>&nb sp;</td>
<td align=center><i nput size=40 type="submit" value="Save Checking" name="add" class="submit" /></td>
</tr>
</form>
</table>
I have discover this problem when I inserted the scores of the students i a centain subject.
I am making a school project with regards to saving students' record.
first, I have to view all students under the certain subject and at the last field, I putted a form to put the scores of each student.
say '<input type=text name='score' size=10>' and number of '<input type=text>' is equal to the number of students.
I use the primary key of the students(IdNo) to be inserted at in the first field of the table(studScore ).
this is the problem, i want to insert the score of each student from the '<input>' in the second field of the said table.
I am thinking that maybe it deals with array, but i really don't know how to formulate it.
The solution to this problem would be my key in finishing this project.
Anyone?
Thanks in advance.
God Speed!
heres my sample code:
////ADDING SCORE
$addscore=$_GET['score'];
if($addscore){
?>
<table border=1 bgcolor=#E7EBED width=829>
<form action='<? PHP_SELF; ?>' method=post>
<tr align=center>
<td colspan=8><font face="Tahoma" size="2" color=00000><b> Result/s</b></font> </td>
</tr>
<tr align=center>
<td colspan=8>  ;</td>
</tr>
<?
}
$control=$_GET['subControl'];
$result = mysql_query( "SELECT students.IDNO,s tudents.FIRSTNA ME,students.LAS TNAME,students. MI,students.GEN DER,students.CO URSE,students.Y EAR FROM students,subjec ts,subjecttrans WHERE subjects.SUB_CO NTROL=subjecttr ans.SUBCONTROL AND subjecttrans.SU BCONTROL='$cont rol' AND subjecttrans.ID NO=students.IDN O ORDER BY students.LASTNA ME" ) or die ("SELECT Error: ".mysql_error() );
$num_rows=mysql _num_rows($resu lt);
//start if
if($num_rows > 0){
?>
<tr>
<th><font face="Tahoma" size="2" color=CC3300><b >Id No.</b></font> </th>
<th align=center><f ont face="Tahoma" size="2" color=CC3300>St udents' Name</b></font> </th>
<th><font face="Tahoma" size="2" color=CC3300>Ge nder</b></font> </th>
<th><font face="Tahoma" size="2" color=CC3300>Co urse</b></font> </th>
<th><font face="Tahoma" size="2" color=CC3300>Ye ar</b></font> </th>
<th><font face="Tahoma" size="2" color=CC3300>Ad d Score</b></font> </th>
</tr>
<tr align=center>
<td colspan=8>  ;</td>
</tr>
<form action="<? PHP_SELF; ?>" method=post>
<? $i=0;
while ($i < $num_rows) {
?>
<tr height=15 class=off onmouseover="th is.className='o n'" onmouseout="thi s.className='of f'">
<?
$id=mysql_resul t($result,$i,"I DNO");
$fn=mysql_resul t($result,$i,"F IRSTNAME");
$ln=mysql_resul t($result,$i,"L ASTNAME");
$mi=mysql_resul t($result,$i,"M I");
$gen=mysql_resu lt($result,$i," GENDER");
$cors=mysql_res ult($result,$i, "COURSE");
$yer=mysql_resu lt($result,$i," YEAR");
?>
<td> <fo nt face="Tahoma" size="2" color=666622><? echo $id; ?></font></td>
<td align=left>&nbs p;<font face="Tahoma" size="2" color=666622><? echo strtoupper($ln. ","." ".$fn." ".$mi); ?> </font> </td>
<td> <fo nt face="Tahoma" size="2" color=666622><? echo substr($gen,0,1 ); ?></font></td>
<td> <fo nt face="Tahoma" size="2" color=666622><? echo strtoupper($cor s); ?></font></td>
<td> <fo nt face="Tahoma" size="2" color=666622><? echo strtoupper($yer ); ?></font></td>
<-----this is the '<input>' i've tried to explain----->
<td> <fo nt face="Tahoma" size="2" color=666622><i nput name="score" type="text"></td>
<?
$i++;
}
?>
</tr>
<tr height=20>
<td colspan=8 align=center>&n bsp;<font face="Tahoma" color=666666 size="2">****No thing Follows****</font></td>
</tr>
<tr>
<td align=right>&nb sp;</td>
<td align=right>&nb sp;</td>
<td align=center><i nput size=40 type="submit" value="Save Checking" name="add" class="submit" /></td>
</tr>
</form>
</table>
Comment