Saludos.
Tengo un problema en el cual estoy haciendo una agenda y borrar e insertar si que me funcionan pero cuando voy a actualizar un registro no me deja,es decir,me lo borra y no se porque.
A continuacion os pongo el codigo que utilizo para modificar.
 
<?php
   //connect to database
   $mysqli = mysqli_connect("localhost", "joeuser", "somepass", "lista");
 
  if (!$_POST)  {
       //haven't seen the selection form, so show it
      $display_block = "<h1>Selecciona un registro</h1>";
 
       //get parts of records
      $get_list_sql = "SELECT id,
                         CONCAT_WS(', ', l_name, f_name) AS display_name
                         FROM master_name ORDER BY l_name, f_name";
         $get_list_res = mysqli_query($mysqli, $get_list_sql)
                     or die(mysqli_error($mysqli));
 
      if (mysqli_num_rows($get_list_res) < 1) {
           //no records
           $display_block .= "<p><em>No hay registros para seleccionar!</em></p>";
 
       } else {
           //has records, so get results and print in a form
           $display_block .= "
             <form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">
              <p><strong>Selecciona un contacto:</strong><br/>
              <select name=\"sel_id\">
              <option value=\"\">-- Elige uno --</option>";
 
              while ($recs = mysqli_fetch_array($get_list_res)) {
                 $id = $recs['id'];
                $display_name = stripslashes($recs["display_name"]);
                $display_block .= "<option value=\"".$id."\">".
               $display_name."</option>";
          }
 
             $display_block .= "
            </select>
            <p><input type=\"submit\" name=\"submit\"
                      value=\"Modificar Registro seleccionado\"></p></br><a href=\"mymenu.html\">Menu Principal</a>
           </form>";
      }
//free result
         mysqli_free_result($get_list_res);
} else if ($_POST) {
     //check for required fields
     if ($_POST["sel_id"] == "")  {
         header("Location: modentry.php");
         exit;
     }
 
   $display_block = "
       <form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">
       <p><strong>Nombre y Apellidos:</strong><br/>
      <input type=\"text\" name=\"f_name\" size=\"30\" maxlength=\"75\">
      <input type=\"text\" name=\"l_name\" size=\"30\" maxlength=\"75\"></p>
 
      <p><strong>Direccion:</strong><br/>
     <input type=\"text\" name=\"address\" size=\"30\"></p>
 
      <p><strong>Ciudad/Estado/CP:</strong><br/>
      <input type=\"text\" name=\"city\" size=\"30\" maxlength=\"50\">
      <input type=\"text\" name=\"state\" size=\"5\" maxlength=\"2\">
      <input type=\"text\" name=\"zipcode\" size=\"10\" maxlength=\"10\"></p>
 
     <p><strong>Tipo de Direccion:</strong><br/>
      <input type=\"radio\" name=\"add_type\" value=\"home\" checked> home
      <input type=\"radio\" name=\"add_type\" value=\"work\"> work
      <input type=\"radio\" name=\"add_type\" value=\"other\"> other</p>
 
      <p><strong>Nº Tel:</strong><br/>
     <input type=\"text\" name=\"tel_number\" size=\"30\" maxlength=\"25\">
      <input type=\"radio\" name=\"tel_type\" value=\"home\" checked> home
     <input type=\"radio\" name=\"tel_type\" value=\"work\"> work
      <input type=\"radio\" name=\"tel_type\" value=\"other\"> other</p>
 
     <p><strong>FAX:</strong><br/>
      <input type=\"text\" name=\"fax_number\" size=\"30\" maxlength=\"25\">
      <input type=\"radio\" name=\"fax_type\" value=\"home\" checked> home
      <input type=\"radio\" name=\"fax_type\" value=\"work\"> work
      <input type=\"radio\" name=\"fax_type\" value=\"other\"> other</p>
 
      <p><strong>Email:</strong><br/>
      <input type=\"text\" name=\"email\" size=\"30\" maxlength=\"150\">
      <input type=\"radio\" name=\"email_type\" value=\"home\" checked> home
      <input type=\"radio\" name=\"email_type\" value=\"work\"> work
      <input type=\"radio\" name=\"email_type\" value=\"other\"> other</p>
 
     <p><strong>Notas:</strong><br/>
      <textarea name=\"note\" cols=\"35\" rows=\"3\"
     wrap=\"virtual\"></textarea></p>
 
     <p><input type=\"submit\" name=\"submit\" value=\"Modificar Registro\"></p>
      </form>";
 
	  $upd_master_fname = "UPDATE address set address = '".$_POST["address"]."' WHERE
                       id = '".$_POST["sel_id"]."'";
   $del_master_res = mysqli_query($mysqli, $upd_master_fname)
                      or die(mysqli_error($mysqli));
 
 
 mysqli_close($mysqli);
}	 
?>
<html>
<head>
 <title>Mis Registros</title>
 </head>
 <body>
 <?php echo $display_block; ?>
 </body>
 </html> 
   
 



