0
if (@$_GET['action'] == "Edit Record") {
    print "<font color=black size=14><center>Edit Student Records</center></font><br>";
     $result = mysql_query ("SELECT * FROM students");
     $rows = mysql_num_rows($result);
    if ($rows != 0) {
        print "<form>";
        print "<font color=black><center><b>Select Student:</b><center></font><br>";
        print "<select  name=idnum>";
        for ($i=0; $i< $rows; $i++) {
           $row = mysql_fetch_row($result);
           print "<option value=$row[0]>$row[1] $row[3] $row[2]";
        }
        print "</select>";
        print "<br><br>   <input type=submit name=action value=Edit>";
        print "</form>";
     }
     else {
            print "<font color=silver size=12><center>No Records Found</center></font>";

     }
     mysql_free_result ($result); 
  }
  if (@$_GET['action'] == "Edit"){





$locker = mysql_query("LOCK TABLE students write "); 
$result = mysql_query ("Select * from students where idnum='$_GET[idnum]' LOCK IN SHARE MODE ");
$row = mysql_fetch_row ($result);
if($row[4]=='Male')
       {
         $dgender = "<font color=white>Male<input type = radio name=gender value=Male checked>&nbsp;&nbsp;&nbsp;<font color=white>Female<input type = radio name = gender  value=Female> "; 
        }
     else 
        {    
          $dgender = "<font color=white>Male</font><input type = radio name=gender value=Male  >&nbsp;&nbsp;&nbsp;<font color=white>Female<input type = radio name = gender  value=Female checked> ";
        }

     print "<font color=white size=14><center>Edit Student Records  </center></font><br>";
 print "<center><form method = get> 
 <input type=hidden name=idnum value=$row[0]>
  <table border = 1> 


<td><font color=white size=5>ID Number:</font></td><td>
 <input type=text name=idnum value=$row[0] disabled></td></tr>



<td><font color=white size=5>First Name:</font></td>
 <td><input type = text name = fname size=50 value=$row[1] ></td></tr>

  <td><font color=white size=5>Last Name:</font></td>
 <td><input type = text name = lname size=50 value=$row[2] ></td></tr>
 <tr>
<td><font color=white size=5>Middle Initial:</font></td>
<td><input type=text name=midin size=50 value=$row[3]></td><tr> 



<td><font color=red size=5>Gender</font></td><td>$dgender</td></tr>


<tr><td><font color=white size=5>Birthday:(YYYY-MM-DD)</font></td>
<td><input type=text name=bdate size=50 value=$row[5]></td><tr> 

 <td><font color=white size=5>Course:</font></td>
<td><select name = course>
<option value = $row[6]>$row[6]</option>
<option value = IT>Information Technology</option>

    <option value = CS>Computer Science</option>

    <option value = IM>Information Management</option>

    <option value = IS>Information System</option>

    <option value = CRIM>Criminology</option>

    <option value = BSN>Nursing</option>

    <option value = RadTech>Radiologic Technology</option>

    <option value = HRM>Hotel and Restaurant Management</option>

    <option value = TOUR>Tourism</option>

    </select></td></tr>
<tr><td><font color=red size=5>Year Level:</font></td>

       <td><select name = year>

<option value = $row[7]>$row[7]</option>    
<option value = I>I</option>

    <option value = II>II</option>

    <option value = III>III</option>

    <option value = IV>IV</option>

    <option value = V>V</option>

    </select></td></tr>
<tr>
<td><font color=red size=5>Address:</font></td>
<td><input type=Text name=address size=50 value=$row[8]></td>
    </tr>
<tr>



<td><font color=red size=5>Contact Number:</font></td>
<td><input type=Text name=cnum size=50 value=$row[9]></td>
</tr>

<tr bgcolor=><td><input type=submit value=Update Submit name=action></td></tr> 


</center>    
</table>

</form> ";

}

i have this edit code, but it won't run as i desire.
everytime i edit names with space like two names won't show the other name separated by space.
any help guys? thanks a lot.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by pritaeas
0

value=$row[9]

An attribute value should be enclosed in quotes, like this:

value=\"$row[9]\"

or:

value='$row[9]'
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.