0

I have this code that checks the attendance os students:

$counter = 0;

                       while($rw = mysql_fetch_array($result))
                        {
                            echo "<tr>";
                                echo "<td>" .$rw['Name']. "</td>";
                                echo "<td>" .$rw['student_id']. "</td>";
                                echo "<td>". '<input type="radio" id="present'.$counter.'" name="optradio'.$counter.'">' ."</td>";
                                echo "<td>". '<input type="radio" id="late'.$counter.'" name="optradio'.$counter.'">' ."</td>";
                                echo "<td>". '<input type="radio" id="absent'.$counter.'" name="optradio'.$counter.'">' ."</td>";
                                echo "<td>".'' ."</td>";
                                echo "<td>".''."</td>";
                                echo "<td>". '' ."</td>";
                                echo "<td>". date('m/d/Y') ."</td>";
                                echo '</tr>';
                                $counter++;
                     }

                    echo'</tbody>';

                    echo'</table>';
                    echo'<div style="float: right; margin-top: 10px; margin-right:10px;">';
                    echo '<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>';
                    echo '&nbsp';
                    echo '<button type="Submit" name="saveAttendance" class="btn btn-primary">Save</button>';
                    echo '</div>'; 

How will I save it to my database? I was told that I have to loop it and save it to an array before I could save it but I don't have any idea how. I'm only a beginner. Thank you in advance!

Jay
  • 3
  • 4
  • If you're a beginner, why are you using ten year old, unmaintained, insecure, and deprecated database functions? See [details here](http://stackoverflow.com/q/12859942/1255289) and stop what you're doing! – miken32 Apr 07 '17 at 01:47
  • dont use mysql, and google how to get the value from radio button php database – arif_suhail_123 Apr 07 '17 at 01:47
  • First figure out how to build an html form. Then how to get your data submitted on this form in your php script. Finally you can look up how to store data into database with more up-to-date PHP functionalities such as mysqli. – TurtleTread Apr 07 '17 at 01:53
  • I just got this code from a friend so I'm trying to figure out how to go around with this code. – Jay Apr 07 '17 at 02:55
  • jay this code is bokus, people can run sql injection with mysqli, and you are using mysql, use google, get the latest code, i have some vedio, on how to run sql injection if website is vunrable, specially created with this kind of code, check it out https://www.youtube.com/channel/UCCW6D8WcDv-FgyhwnltB3SQ – arif_suhail_123 Apr 07 '17 at 03:14

0 Answers0