Hi, i want to code a .php file that will take information from an sql database based on a search query and then put the retrieved data into an html table that i've created within another file
essentially, i'm trying to 'add students' into a club table...
my current php code posts my collected data
based on what my html page passes to it
and this is a snippet from the file containing the table i want this info to load into:
So....is it possible to change the $POST function into something that loads the info into the html table and if yes, how so?
Thanks
essentially, i'm trying to 'add students' into a club table...
my current php code posts my collected data
Code:
<?php mysql_connect ("localhost", "testuser","") or die (mysql_error()); mysql_select_db ("studentinformation"); $term = $_POST['term']; $sql = mysql_query("select * from testtable where StudentNumber like '%$term%'"); while ($row = mysql_fetch_array($sql)){ echo 'Student Number: '.$row['StudentNumber']; echo '<br/> First Name: '.$row['FirstName']; echo '<br/> Last Name: '.$row['LastName']; echo '<br/> Grade: '.$row['Grade']; echo '<br/><br/>'; } ?>
Code:
<html> <head> <title>Search the Database</table> </head> <body> <form action="search.php" method="post" Search: <input type="text" name="term" /><br /> <input type="submit" name="submit" value="Submit" /> </body> </html>
Code:
<div align="center"> <table border="1" width="96%"> <tr> <td width="33" bgcolor="#FFFFFF"> <p align="center"><input type="checkbox" name="C5" value="ON"></td> <td width="185" bgcolor="#FFFFFF" align="center"><b> <font face="Arial" size="4" color="#008000">Student Number</font></b></td> <td width="214" bgcolor="#FFFFFF" align="center"><b> <font face="Arial" size="4" color="#008000">Student First Name</font></b></td> <td width="251" bgcolor="#FFFFFF" align="center"><b> <font face="Arial" size="4" color="#008000">Student Surname</font></b></td> <td bgcolor="#FFFFFF" align="center"><b> <font face="Arial" size="4" color="#008000">Grade</font></b></td> <td bgcolor="#FFFFFF" align="center"><b> <font face="Arial" size="4" color="#008000">Number of Points</font></b></td> <td bgcolor="#FFFFFF" align="center"><b> <font face="Arial" size="4" color="#008000">Date Added</font></b></td> </tr> <tr> <td width="33" align="center"> <input type="checkbox" name="C1" value="ON"></td> <td width="185"> </td> <td width="214"> </td> <td width="251"> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td width="33" align="center"> <input type="checkbox" name="C2" value="ON"></td> <td width="185"> </td> <td width="214"> </td> <td width="251"> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td width="33" align="center"> <input type="checkbox" name="C3" value="ON"></td> <td width="185"> </td> <td width="214"> </td> <td width="251"> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td width="33" align="center"> <input type="checkbox" name="C4" value="ON"></td> <td width="185"> </td> <td width="214"> </td> <td width="251"> </td> <td> </td> <td> </td> <td> </td> </tr> </table> </div>
Thanks
Comment