Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start(); ?>
- <?php require('includes/dbconnect.php'); ?>
- <?php require 'includes/header.inc.php'; ?>
- <?php
- $matric_no = mysql_real_escape_string($_POST['matric_no']) ;
- if ($_POST['matric_no'] == "")
- {
- echo"<div id=\"contentRight\">";
- echo"<idv id=\"msg\">" ;
- echo "You didn't enter a <span style=\"color:red\">Matric Number</span>";
- echo"</div>" ;
- echo"</div>" ;
- exit();
- }
- $query = "SELECT matric_no
- FROM students
- WHERE matric_no = '$_POST[matric_no]'";
- $result = mysql_query($query) ;
- $duplicates = mysql_num_rows($result);
- if ($duplicates < 1)
- {
- echo"<div id=\"contentRight\">";
- echo"<idv id=\"msg\">" ;
- echo "You dont have a record for <span style=\"color:red\">$matric_no</span>" ;
- echo"</div>" ;
- echo"</div>" ;
- exit();
- }
- $result = mysql_query("SELECT matric_no, first_name, last_name, other_name
- FROM students
- WHERE matric_no = '".mysql_real_escape_string($_POST['matric_no'])."'") or die(mysql_error());
- $number_cols = mysql_num_fields($result) ;
- echo "<div id=\"contentRight\">" ;
- echo "<span class=\"header\">";
- echo "<p><b>Matric Number: ".mysql_real_escape_string($_POST['matric_no'])."</b></p>";
- echo "<table border = 1 , cellspacing = 0 , cellpadding = 2 bgcolor = lemonchiffon >\n";
- echo "<tr align=center>\n";
- for ($i=0; $i<$number_cols; $i++)
- {
- echo "<th>" . mysql_field_name($result, $i). "</th>\n";
- }
- echo "</tr>\n";
- //end table header
- //layout table body
- while ($row = mysql_fetch_row($result))
- {
- echo "<tr align=center>\n";
- for ($i=0; $i<$number_cols; $i++)
- {
- echo "<td>";
- if (!isset($row[$i])) //test for null value
- {echo "NULL";}
- else
- {echo $row[$i];}
- echo "</td>\n";
- }
- echo "</tr>\n";
- }
- echo "</table>";
- echo"</span>" ;
- echo"</div>";
- ?>
- <br />
- <?php
- while($row = mysql_fetch_array($result)){
- ?>
- <div id="contentRight">
- <p>
- Select the Score options you will like to update:
- <form action="student_update2.php" method="post">
- <ul>
- <li>Matric Number: <input type="text" name="matric_no"> </li><br /><br />
- <li>First Name: <input type="text" name="first_name"> </li><br /><br />
- <li>Last Name: <input type="text" name="last_name"> </li><br /><br />
- <li>Other Names: <input type="text" name="other_name" value="<?php echo $row1['other_name'] ; ?>"</li> <br /><br />
- <input type="submit" name="submit" value="Update" />
- <input type="hidden" name="submitted" value="TRUE" />
- <input name="Reset" type="reset" value="Reset" />
- </ul>
- </div>
- </div>
- </form>
- <?php
- }
- require 'includes/footer.php'; ?>
Add Comment
Please, Sign In to add comment