<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<?php
$lianjie = mysql_connect ("localhost", "root", "Xiaolie") or Die ("Connection failed");
mysql_query ("Set names UTF8");
if ($lianjie)
{
mysql_select_db ("Xiaolie");
if (!$_get)
{
$xuanbiao = "SELECT * from Zhuce";
$fasong = mysql_query ($xuanbiao) or Die (Mysql_error ());
echo "<table border=1>
<tr>
<td> number </td>
<td> User name </td>
<td> Sex </td>
<td> Age </td>
<td> Registration Time </td>
<td> Operations </td>
</tr> ";
while ($nr =mysql_fetch_array ($fasong))
{
echo "<tr>
<td> ". $NR [" id "]." </td>
<td> ". $nr [" name "]." </td>
<td> ". $nr [" Xingbie "]." </td>
<td> ". $nr [" nianling "]." </td>
<td> ". $nr [" Zc_shijian "]." </td>
<td><a href=gx_my.php?id= ". $NR [" id "]." > Edit </a></td>
</tr> ";
}
echo "</table>";
}
Else
{
if (!$_post)
{
$xianid = "SELECT * from Zhuce where id=". $_get["id"];
$fasong = mysql_query ($xianid) or Die (Mysql_error ());
$NR = Mysql_fetch_array ($fasong);
?>
<form method=post action= "gx_my.php?id=<?php echo $_get[" id ";? > ">
<?php
echo $NR ["id"]. " <br> ";
?>
<input type= "hidden" name= "id" value=<?php echo $nr ["id"];? >>
Name <input type= "text" name= "name" value=<?php echo $nr ["name"];? >><br>
Gender <input type= "text" name= "Xingbie" value=<?php echo $nr ["Xingbie"];? >><br>
Age <input type= "text" name= "nianling" value=<?php echo $nr ["nianling"];? >><br>
Registration time <input type= "text" name= "Zc_shijian" value=<?php echo $nr ["Zc_shijian"];? >><br>
<input type= "Submit" Name= "OK" value= "submitted" >
</form>
<?php
}
Else
{
$GX = "Update zhuce set Name= '". $_post["name". "', xingbie= '". $_post["Xingbie"]. "', nianling= '". $_post["Nianling"]. " , zc_shijian= '. $_post["Zc_shijian"]. "' Where id= '. $_post[' id ']." ' ";
$fasong = mysql_query ($GX);
if ($fasong) {
echo "Record has been successfully modified <br><a href=gx_my.php> continue to modify the record </a>";}
else{
echo "Record modification failed <br><a href=gx_my.php?id=". $_post["id"]. " > Return </a> "; }
}
}
}