Código PHP:
<?php
include ("color.php");
include ("conexion.php");
?>
<center><form method="get" action="">
<table width="250" border="1" style="border:2px solid #C06">
<tr style="background-color:#906;color:white">
<th colspan="2">Nuevo Paciente</th>
</tr>
<tr>
<td>Codigo</td>
<td><input type="text" name="txtcodigo"/></td>
</tr>
<tr>
<td>Nombre</td>
<td><input type="text" name="txtnombre"/></td>
</tr>
<tr>
<td>Apellidos</td>
<td><input type="text" name="txtapellido"/></td>
</tr>
<tr>
<td>Sexo</td>
<td><input type="text" name="txtsexo"/></td>
</tr>
<tr>
<td>DNI</td>
<td><input type="text" name="txtdni"/></td>
</tr>
<tr>
<td>Telefono</td>
<td><input type="text" name="txttelefono"/></td>
</tr>
<tr>
<td>Ocupacion</td>
<td><input type="text" name="txtocupacion"/></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="REGISTRAR" name="enviar"/></td>
</tr>
</table>
</form </center>
<?php
if (isset($_GET['enviar'])&&
$_GET['txtcodigo']!=""&&
$_GET['txtnombre']!=""&&
$_GET['txtapellido']!=""&&
$_GET['txtsexo']!=""&&
$_GET['txtdni']!=""&&
$_GET['txttelefono']!=""&&
$_GET['txtocupacion']!=""){
$cod=$_GET['txtcodigo'];
$nom=$_GET['txtnombre'];
$ape=$_GET['txtapellido'];
$sex=$_GET['txtsexo'];
$dni=$_GET['txtdni'];
$tel=$_GET['txttelefono'];
$ocu=$_GET['txtocupacion'];
$sql="INSERT INTO PACIENTE VALUES('$cod','$nom','$ape','$sex','$dni','$tel','$ocu')";
$rs=mysql_query($sql,$db);
header("location:Registro.php");
}
?>
<?php
$sql="select * from paciente";
$rs=mysql_query($sql,$db);
echo "<table width='200' border='1' style='border:1px solid #C06'>";
echo "<tr style='background-color:#906;color:white'>";
echo "<th colspan='9'>Listado de Pacientes </th>";
echo "</tr>";
echo " <tr>";
echo " <th>CODIGO</th><th>NOMBRE</th>";
echo " <th>APELLIDO</th><th>SEXO</th>";
echo " <th>DNI</th><th>TELEFONO</th>";
echo " <th>OCUPACION</th>";
echo " <th></th>";
echo " <th></th>";
echo " </tr>";
while($fila=mysql_fetch_array($rs)){
echo " <tr>";
echo " <td>";
echo $fila['CodigoPaciente'];
echo " </td>";
echo " <td>";
echo $fila['Nombre'];
echo " </td>";
echo " <td>";
echo $fila['Apellido'];
echo " </td>";
echo " <td>";
echo $fila['Sexo'];
echo " </td>";
echo " <td>";
echo $fila['DNI'];
echo " </td>";
echo " <td>";
echo $fila['Telefono'];
echo " </td>";
echo " <td>";
echo $fila['Ocuapacion'];
echo " </td>";
echo " <td>";
echo "<a href='editar.php'> <INPUT TYPE='image' SRC='lapiz.png' title='editar'BORDER='0'width='20' height='20' align='middle'></a>";
echo " </td>";
echo " <td>";
echo "<INPUT TYPE='image' SRC='eliminar.png' title='eliminar' BORDER='0'width='20' height='20' align='middle'>";
echo " </td>";
echo " </tr>";
}
echo "</table>";
?>