Jump to content

mau03

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by mau03

  1. <-------------------------> //student_edit_form.php <table border=1> <tr> <td align=center><h1>Form Edit Student Data</h1></td> </tr> <tr> <td> <table> <?php include "connect.inc"; $id = $_GET['id']; $query="SELECT * FROM student where id='$id'"; $result=mysql_query($query); //$record=mysql_numrows($result); ?> <?php while ($row=mysql_fetch_array($result)){ $id = $row["id"]; $studno = $row["studno"]; $fname = $row["fname"]; $lname = $row["lname"]; $mi = $row["mi"]; $age = $row["age"]; $address = $row["address"]; $bday = $row["bday"]; $sex = $row["sex"]; $contactnum = $row["contactnum"]; $course = $row["course"]; $section = $row["section"]; } ?> <form method="post" action="edit_data.php"> <input type="hidden" name="id" value="<?php echo $id; ?>"> <tr> <td>Student Number</td> <td> <?php echo $studno; ?> </td> </tr> <tr> <td>First Name</td> <td> <input type="text" name="firstname" size="40" value="<?php echo $fname; ?>"> </td> </tr> <tr> <td>Last Name</td> <td> <input type="text" name="lastname" size="40" value="<?php echo $lname; ?>"> </td> </tr> <tr> <td>M.I </td> <td> <input type="text" name="mi" size="40" value="<?php echo $mi; ?>"> </td> </tr> <tr> <td>Age</td> <td> <input type="text" name="age" size="40" value="<?php echo $age; ?>"> </td> </tr> <tr> <td>Address </td> <td> <input type="text" name="address" size="40" value="<?php echo $address; ?>"> </td> </tr> <tr> <td>Birthday </td> <td> <input type="text" name="bday" size="40" value="<?php echo $bday; ?>"> </td> </tr> <tr> <td>Sex </td> <td> <input type="text" name="sex" size="40" value="<?php echo $sex; ?>"> </td> </tr> <tr> <td>Status </td> <td> <input type="text" name="status" size="40" value="<?php echo $status; ?>"> </td> </tr> <tr> <td>Contact Number</td> <td> <input type="text" name="contactnum" size="40" value="<?php echo $contactnum?>"> </td> </tr> <tr> <td>Course </td> <td> <input type="text" name="course" size="40" value="<?php echo $course; ?>"> </td> </tr> <tr> <td>Section </td> <td> <input type="text" name="section" size="40" value="<?php echo $section; ?>"> </td> </tr> <tr> <td align="right"> <input type="submit" name="submit value" value="Edit"> </td> </tr> </form> </table> </td> </tr> </table> <-------------------------------> // edit_data.php <?php include "connect.inc"; $query = "UPDATE student SET stuno='$studno', fname='$fname', lname='$lname', mi='$mi', age='$age', address='$address', bday='$bday', sex='$sex', contactnum='$contactnum', course='$course', section='$section' WHERE id='$id'"; @mysql_query($query); header("location:edit_stud_info.php"); ?> <--------------> need help here pls it doesn't save to my database
×
×
  • Create New...