Tengo un formulario con php
y html
, en el cual, quiero modificar mi Base de Datos. Solo que estoy en confuso con este mensaje de error.
Formulario
<?php
require('../admin/conexion.php');
$id=$_GET['id'];
$query="SELECT empresa, marca, modelo, n_serie, tipo, procesador, vel_procesador, memoria_ram, disco_duro1, disco_duro2, sistema_operativo, g_inicio, g_final FROM computadora WHERE id='$id'";
$resultado=$mysqli->query($query);
$row=$resultado->fetch_assoc();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Modificar - Computadora</title>
<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
body {
background-image: url(../imagenes/imagen_student.jpg);
background-size:100% 100%;
background-attachment:fixed;
}
</style>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<center>
<table>
<form method="POST" action="modificar_computadora.php"> <!-- Archivo PHP de llamada -->
<div class="container">
<p><br/></p>
<div class="row">
<div class="col-md-8"></div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-body">
<div class="page-header">
<h3>Modificar Computadora</h3>
<!-- Formulario de llamada -->
<form role="form">
<div class="form-group">
<label for="exampleInputEmail1">Empresa</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
<input type="text" class="form-control" name = "empresa" value="<?php echo $row['empresa'];?>" <!--id="exampleInputEmail-->"
</div>
<form role="form">
<div class="form group">
<label for="exampleInputPassword1">Marca</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-file"></span></span>
<input type="text" class="form-control" name = "marca" value="<?php echo $row['marca']; ?>" <!--id="exampleInputEmail2-->"
</div>
<form role="form">
<div class="form group">
<label for="exampleInputPassword1">Modelo</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-road"></span></span>
<input type="text" class="form-control" name = "modelo" value="<?php echo $row['modelo']; ?>" <!--id="exampleInputEmail2-->"
</div>
<form role="form">
<div class="form group">
<label for="exampleInputPassword1">N° Serie</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-list-alt"></span></span>
<input type="text" class="form-control" name = "n_serie" value="<?php echo $row['n_serie']; ?>" <!--id="exampleInputEmail2-->"
</div>
<form role="form">
<div class="form group">
<label for="exampleInputPassword1">Tipo</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-heart"></span></span>
<input type="text" class="form-control" name = "tipo" value="<?php echo $row['tipo']; ?>" <!--id="exampleInputEmail2-->"
</div>
<form role="form">
<div class="form group">
<label for="exampleInputPassword1">Procesador</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-heart"></span></span>
<input type="text" class="form-control" name = "procesador" value="<?php echo $row['procesador']; ?>" <!--id="exampleInputEmail2-->"
</div>
<form role="form">
<div class="form group">
<label for="exampleInputPassword1">Velocidad del Procesador</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-heart"></span></span>
<input type="text" class="form-control" name = "vel_procesador" value="<?php echo $row['vel_procesador']; ?>" <!--id="exampleInputEmail2-->"
</div>
<form role="form">
<div class="form group">
<label for="exampleInputPassword1">Memoria RAM</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-heart"></span></span>
<input type="text" class="form-control" name = "memoria_ram" value="<?php echo $row['memoria_ram']; ?>" <!--id="exampleInputEmail2-->"
</div>
<form role="form">
<div class="form group">
<label for="exampleInputPassword1">Disco Duro 1</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-heart"></span></span>
<input type="text" class="form-control" name = "disco_duro1" value="<?php echo $row['disco_duro1']; ?>" <!--id="exampleInputEmail2-->"
</div>
<form role="form">
<div class="form group">
<label for="exampleInputPassword1">Disco Duro 2</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-heart"></span></span>
<input type="text" class="form-control" name = "disco_duro2" value="<?php echo $row['disco_duro2']; ?>" <!--id="exampleInputEmail2-->"
</div>
<form role="form">
<div class="form group">
<label for="exampleInputPassword1">Sistema Operativo</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-heart"></span></span>
<input type="text" class="form-control" name = "sistema_operativo" value="<?php echo $row['sistema_operativo']; ?>" <!--id="exampleInputEmail2-->"
</div>
<form role="form">
<div class="form group">
<label for="exampleInputPassword1">Garantia Inicio</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-heart"></span></span>
<input type="date" class="form-control" name = "g_inicio" value="<?php echo $row['g_inicio']; ?>" <!--id="exampleInputEmail2-->"
</div>
<form role="form">
<div class="form group">
<label for="exampleInputPassword1">Garantia Final</label>
<div class="form-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-heart"></span></span>
<input type="date" class="form-control" name = "g_final" value="<?php echo $row['g_final']; ?>" <!--id="exampleInputEmail2-->"
</div>
<hr/>
<button type="button" class="btn btn-success"><span class="glyphicon glyphicon-circle-arrow-left"></span>Atras</button>
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-pencil"></span>Modificar</button>
<p><br/></p>
</form>
</div>
</div>
</div>
<span class="form-group"></span>
</div>
</div>
<form>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
</center>
</body>
</html>
<?php
require('../admin/conexion.php');
$id=$_POST['id'];
$empresa=$_POST['empresa'];
$marca=$_POST['marca'];
$modelo=$_POST['modelo'];
$n_serie=$_POST['n_serie'];
$tipo=$_POST['tipo'];
$procesador=$_POST['procesador'];
$vel_procesador=$_POST['$vel_procesador'];
$memoria_ram=$_POST['$memoria_ram'];
$disco_duro1=$_POST['$disco_duro1'];
$disco_duro2=$_POST['disco_duro2'];
$sistema_operativo=$_POST['sistema_operativo'];
$g_inicio=$_POST['$g_inicio'];
$g_final=$_POST['$g_final'];
$query="UPDATE computadora SET empresa='$empresa', marca='$marca', modelo='$modelo', n_serie='$n_serie', tipo='$tipo', procesador='$procesador', vel_procesador='$vel_procesador', memoria_ram='$memoria_ram', disco_duro1='$disco_duro1', disco_duro2='$disco_duro2', sistema_operativo='$sistema_operativo', g_inicio='$g_inicio', g_final='$g_final' WHERE id='$id'";
$resultado=$mysqli->query($query);
?>
<html>
<head>
<title>Modificar Computadora</title>
</head>
<body>
<center>
<?php
if($resultado>0){
?>
<h1>Computadora Modificada</h1>
<?php }else{ ?>
<h1>Error, Computadora NO Modificada</h1>
<?php } ?>
<p></p>
<a href="../menu_principal.php">Menu Principal</a>
</center>
</body>
</html>
'id'
a través dePOST
a tu archivo PHP, es decir ningun input tiene el atributoname='id'
, por no hablar porque tantos tags deform
ya que es algo que no está permitido hacer.id
@Lixus y luego se salta a Notice: Undefined index: $vel_procesador in C:\wamp64\www\Inventario\computadora\modificar_computadora.php on line 13