Results 1 to 1 of 1
Related
-
how i include a table in multiple sites? Forum: HTML Forum
Replies: 3 -
create table in mysql from php forms Forum: PHP Forum
Replies: 2 -
How to select multiple values from a table? Forum: Databases
Replies: 1 -
Help on multiple table's with MySQL with PHP Forum: PHP Forum
Replies: 1
-
01-29-2008, 01:09 AM #1
Inserting Multiple value of '<input>' to a table in PHP/MySQL
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:
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,students.FIRSTNAME,students.LASTNAME,students.MI,students.GENDER,students.COURSE,students.YEAR FROM students,subjects,subjecttrans WHERE subjects.SUB_CONTROL=subjecttrans.SUBCONTROL AND subjecttrans.SUBCONTROL='$control' AND subjecttrans.IDNO=students.IDNO ORDER BY students.LASTNAME" ) or die ("SELECT Error: ".mysql_error()); $num_rows=mysql_num_rows($result); //start if if($num_rows > 0){ ?> <tr> <th><font face="Tahoma" size="2" color=CC3300><b>Id No.</b></font> </th> <th align=center><font face="Tahoma" size="2" color=CC3300>Students' Name</b></font> </th> <th><font face="Tahoma" size="2" color=CC3300>Gender</b></font> </th> <th><font face="Tahoma" size="2" color=CC3300>Course</b></font> </th> <th><font face="Tahoma" size="2" color=CC3300>Year</b></font> </th> <th><font face="Tahoma" size="2" color=CC3300>Check Attendance</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="this.className='on'" onmouseout="this.className='off'"> <? $id=mysql_result($result,$i,"IDNO"); $fn=mysql_result($result,$i,"FIRSTNAME"); $ln=mysql_result($result,$i,"LASTNAME"); $mi=mysql_result($result,$i,"MI"); $gen=mysql_result($result,$i,"GENDER"); $cors=mysql_result($result,$i,"COURSE"); $yer=mysql_result($result,$i,"YEAR"); ?> <td> <font face="Tahoma" size="2" color=666622><? echo $id; ?></font></td> <td align=left> <font face="Tahoma" size="2" color=666622><? echo strtoupper($ln.","." ".$fn." ".$mi); ?> </font> </td> <td> <font face="Tahoma" size="2" color=666622><? echo substr($gen,0,1); ?></font></td> <td> <font face="Tahoma" size="2" color=666622><? echo strtoupper($cors); ?></font></td> <td> <font face="Tahoma" size="2" color=666622><? echo strtoupper($yer); ?></font></td> <-----this is the '<input>' i've tried to explain-----> <td> <font face="Tahoma" size="2" color=666622><input name="score" type="text"></td> <? $i++; } ?> </tr> <tr height=20> <td colspan=8 align=center> <font face="Tahoma" color=666666 size="2">****Nothing Follows****</font></td> </tr> <tr> <td align=right> </td> <td align=right> </td> <td align=center><input size=40 type="submit" value="Save Checking" name="add" class="submit" /></td> </tr> </form> </table>
Last edited by vinyl-junkie; 01-29-2008 at 07:05 AM. Reason: Added code tags
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum