142 users online (0 members and 142 guests)  

  Results 1 to 1 of 1


  1. how i include a table in multiple sites?    Forum: HTML Forum
    Replies: 3
  2. create table in mysql from php forms    Forum: PHP Forum
    Replies: 2
  3. Replies: 1
  4. Replies: 1
  1. #1
    JPhilS's Avatar
    New User

    Join Date
    Jul 2007

    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.


    Thanks in advance.

    God Speed!

    heres my sample code:

          <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 align=center>
           <td colspan=8>&nbsp;</td>
             $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());    
     //start if  
          if($num_rows > 0){
            <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 align=center>
           <td colspan=8>&nbsp;</td>
          <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'">
         <td>&nbsp;<font face="Tahoma" size="2" color=666622><? echo $id; ?></font></td>
         <td align=left>&nbsp;<font face="Tahoma" size="2" color=666622><? echo strtoupper($ln.","." ".$fn." ".$mi); ?> </font> </td>
         <td>&nbsp;<font face="Tahoma" size="2" color=666622><? echo substr($gen,0,1); ?></font></td>
         <td>&nbsp;<font face="Tahoma" size="2" color=666622><? echo strtoupper($cors); ?></font></td>
         <td>&nbsp;<font face="Tahoma" size="2" color=666622><? echo strtoupper($yer); ?></font></td>
    <-----this is the '<input>' i've tried to explain----->     
     <td>&nbsp;<font face="Tahoma" size="2" color=666622><input name="score" type="text"></td>
        <tr height=20>
          <td colspan=8 align=center>&nbsp;<font face="Tahoma" color=666666 size="2">****Nothing Follows****</font></td>
          <td align=right>&nbsp;</td>
          <td align=right>&nbsp;</td>
          <td align=center><input size=40 type="submit" value="Save Checking" name="add" class="submit" /></td>
    Last edited by vinyl-junkie; 01-29-2008 at 07:05 AM. Reason: Added code tags