el primero es un fomulario donde me aparece los datos de la persona entre otras cosas donde se hace la moficacion
Código PHP:
<? include "encabezado.php" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?
if(isset($_POST[enviar]))
{
$local="localhost";
$usuario="root";
$contraseña="";
$basededatos="aseco";
$conexion=mysql_connect($local,$usuario,$contraseña); // Conectar con MySQL
$db= mysql_select_db($basededatos,$conexion);
// $actual=date("y/m/d", filemtime("modificar_reportes.php"));
$fecha_entrega=date("y/m/d");
$busca=mysql_query("SELECT * FROM reportes WHERE reporte like '%$busca%' "); //Busqueda por medio de el campo reportes
$control=$_POST["reportes"];
$row = @mysql_fetch_array($busca);
$nombres=$row[5];
$modelo=$row[4];
$reportes=$row[1];
$serie=$row[3];
$fecha=$row[2];
//$actual=$row[7];
$fecha_entrega=$row[7];
if(mysql_num_rows($busca))
{
$datos=mysql_fetch_row($busca);
echo "<form name=formulario action=cambiar.php method=POST >
<center><b>Modifica el formulario</b><br>
<table>
<tr><td>Nombre:</td> <td><input type='text' name='nombres' value='$nombres' > <br></td></tr>
<tr><td>Modelo:</td> <td><input type='text' name='modelo' value='$modelo' > <br></td></tr>
<tr><td>Reporte:</td> <td><input type='text' name='reportes' value='$reportes' > <br></td></tr>
<tr><td>Serie:</td> <td><input type='text' name='serie' value='$serie'> <br></td></tr>
<tr><td>Confirma Reporte: </td><td><input name='fecha_entrega' type='checkbox' value='$fecha_entrega' />
<!--<tr><td>Fecha de Reporte:</td> <td><input type='text' name='fecha' value='$fecha'> <br></td></tr>-->
<tr><td><input type='submit' value='enviarDatos' name='enviarDatos' /></td>
<td><input name='regresar' value='Volver' type='button' onClick='javascript:history.go (-1)' /></tr>
</form></table></center> ";
}
else
echo "No se encontro el Numero seleccionado";
}
else {
?>
<center>
<form name="cambios" action="modificar_reportes.php" method="POST">
Seleciona el numero de reporte: <input type="text" name="busca" /><br>
<input type="submit" value="enviar" name="enviar" />
<input name="cerrar" type="button" value="Cerrar" onClick="self.close()">
</form>
</center>
<?
}
?>
<body>
</body>
</html>
Código PHP:
<? include "encabezado.php" ?>
<html>
<head><TITLE>Cambiar o Actualizar Registro</TITLE></head>
<body>
<?php
if (isset($_POST[enviarDatos]))
{
$local="localhost";
$usuario="root";
$contraseña="";
$basededatos="aseco";
$conexion=mysql_connect($local,$usuario,$contraseña);
$db= mysql_select_db($basededatos,$conexion); //Archivo para conectar con MySQL
//date("y/m/d", filemtime("modificar_reportes.php"));
$fecha_entrega= date("y/m/d");
mysql_query("UPDATE reportes SET nombres='{$_POST['nombres']}' , modelo='{$_POST['modelo']}', reportes='{$_POST['reportes']}', serie='{$_POST['serie']}', fecha_entrega='{$_POST['fecha_entrega']}'");
echo "<center>El registro se ha realizado satisfactoriamente<br><br> <b>Nombre:</b>".$nombres." <br> <b>Modelo:</b>".$modelo." <br> <b>No. de Reportes:</b>".$reportes."<br> <b>Serie:</b>".$serie."<br> <b>Fecha:</b>".$fecha_entrega."<br> ";
}
?>
<center>Los cambios se han realizado satisfactoriamente<br>
<a href="modificar_reportes.php">Volver</a></center>
</body>
</html>