Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/09/2008, 22:07
Anticlero
Invitado
 
Mensajes: n/a
Puntos:
Problemas con un formulario

Hola estoy empezando a usar php y msql y estoy intentando crear un formulario que me agrege lineas en una base de datos sobre una gestion de un almacen.

Agregar me agrega las lineas el problema es que no tiene en cuenta el valor de que le pongo en los campos os dejo el codigo y ya me direis.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<FORM ACTION="anadir.php" METHOD="GET"> </form>
<table width="452" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="17" height="19">&nbsp;</td>
<td width="213">&nbsp;</td>
<td width="213">&nbsp;</td>
<td width="9">&nbsp;</td>
</tr>
<tr>
<td height="101">&nbsp;</td>
<td valign="top"><form id="form3" name="form3" method="post" action="">
<label>Id producto
<input type="text" name="id">
<br>
<br>
Modelo<br />
<input type="text" name="modelo" />
</label>
<p>
<label>PVP<br />
<input type="text" name="pvp" />
</label>
</p>
</form> </td>
<td valign="top"><form id="form2" name="form2" method="post" action="">
<label>Marca<br />
<input type="text" name="marca" />
</label>
<p>
<label>Coste<br />
<input type="text" name="coste" />
</label>
</p>
</form></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="26"></td>
<td>&nbsp;</td>
<td></td>
<td></td>
</tr>
<tr>
<td height="24"></td>
<td colspan="2" valign="top"><form name="form4" method="post" action="">
<label>
<div align="center">
<input type="submit" name="enviar" value="enviar">
</div>
</label>
</form></td>

<?PHP;
$id=$_GET['id'];
$marca=$_GET['marca'];
$id=$_GET['modelo'];
$id=$_GET['coste'];
$id=$_GET['pvc'];



if ($enviar) {

$conexion = mysql_connect("localhost", "root", "vertrigo");
mysql_select_db("pyme", $conexion);

mysql_query (
" Insert into almacen (id_producto,marca,modelo,coste,PVC)
values('$id','$marca','$modelo','$coste','$pvc') " );

}
?>



<td></td>
</tr>
<tr>
<td height="60"></td>
<td>&nbsp;</td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>