es que tengo todo el codigo en la misma pagina a demas recien la semana pasada empese con php
aqui esta el codigo con el boton enviar quiero hacer el update y con el actualizar el select pero con los 2 botones hace lo mismo lo del selct que carga los cuadros de txto
Código PHP:
<html>
<head>
<title>actualizar datos equipo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?php
include("c:/servidor/web/pruebaconexion.php");
$sql_query="select * from equipamiento_computacional";
$resultado = mysql_query($sql_query);
?>
<body>
<form name="form1" method="post" action="">
<table width="70%" height="413" border="0" align="center">
<tr bordercolor="#000066" bgcolor="#000066">
<td height="95" colspan="2"> <div align="center"><font color="#FFFFFF" size="+2"><strong>Actualizar
Datos Equipo</strong></font></div></td>
</tr>
<tr>
<td width="46%"><div align="right"></div></td>
<td width="54%"> </td>
</tr>
<tr bgcolor="#DDF0F0">
<td> <div align="right">Numero serie </div></td>
<td>
<select name="manda_num_serie">
<?php
while( $row = mysql_fetch_array( $resultado ))
{
printf( "<option value=$row[0]>%s</option>", $row[0] );
}
?>
</select></td>
<?php
$recibe_value=$_POST['manda_num_serie'];
$sql_q="select * from equipamiento_computacional where numero_serie_eq='$recibe_value'";
$resultado = mysql_query($sql_q);
$comprueba=mysql_affected_rows();
if ($comprueba > 0)
{
$row = mysql_fetch_array($resultado);
}
/*else
{
echo "<script>
alert (\"no existen registros con este numero de serie: $recibe_value\");
</script>";
}*/
?>
</tr>
<tr bgcolor="#DDF0F0">
<td> <div align="right">Numero serie </div></td>
<td> <input name="nun_serie_eq" type="text" id="nun_serie_eq" value="<?=$row[0]?>"></td>
</tr>
<tr bgcolor="#DDF0F0">
<td> <div align="right">Tipo </div></td>
<td> <input name="tipo_eq" type="text" id="tipo_eq" value="<?=$row[5]?>"></td>
</tr>
<tr bgcolor="#DDF0F0">
<td> <div align="right">Marca </div></td>
<td> <input name="marca_eq" type="text" id="marca_eq" value="<?=$row[6]?>"></td>
</tr>
<tr bgcolor="#DDF0F0">
<td> <div align="right">Modelo </div></td>
<td> <input name="modelo_eq" type="text" id="modelo_eq" value="<?=$row[7]?>"></td>
</tr>
<tr bgcolor="#DDF0F0">
<td> <div align="right">Descripcion </div></td>
<td> <input name="descripcion_eq" type="text" id="descripcion_eq" value="<?=$row[8]?>"></td>
</tr>
<tr bgcolor="#DDF0F0">
<td> <div align="right">Estado </div></td>
<td> <input name="estado_eq" type="text" id="estado_eq" value="<?=$row[9]?>"></td>
</tr>
<tr bgcolor="#DDF0F0">
<td> <div align="right">Ubicacion </div></td>
<td bgcolor="#DDF0F0"> <input name="ubicacion_eq" type="text" id="ubicacion_eq" value="<?=$row[10]?>">
</td>
</tr>
<tr>
<td><div align="right"> </div></td>
<td> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td> <div align="right">
<input type="submit" name="Submit" value="Enviar">
</div></td>
<td> <input name="actualizar_eq" type="submit" id="actualizar_eq" value="actualizar">
<input name="cancelar" type="reset" id="cancelar" value="cancelar"></td>
</tr>
</table>
</form>
</body>
</html>
<?php
$a=$_POST['a'];
$num_serie=$_POST['num_serie_eq'];
$tipo=$_POST['tipo_eq'];
$marca=$_POST['marca_eq'];
$modelo=$_POST['modelo_eq'];
$descripcion=$_POST['descripcion_eq'];
$estado=$_POST['estado_eq'];
$ubicacion=$_POST['ubicacion_eq'];
if($a=="a")
{
if(!empty($num_serie) and !empty($tipo) and !empty($marca) and !empty($modelo) and !empty($descripcion) and !empty($estado) and !empty($ubicacion))
{
$sql_query="update equipamiento_computacional set tipo_eq='$tipo', marca_eq='$marca', modelo_eq='$modelo', descripcion_eq='$descripcion',
estado_eq='$estado', ubicacion_eq='$ubicacion' where numero_serie_eq='$num_serie'" or die ("no se puedieron actualizar los datos");
$resultado1 = mysql_query($sql_query);
if($resultado1)
{
echo "<script>
alert (\"datos actualizados con exito\");
</script>";
}
}
}
mysql_close($descriptor);
?>