Ver Mensaje Individual
  #2 (permalink)  
Antiguo 16/10/2008, 18:24
Avatar de jaronu
jaronu
 
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 17 años
Puntos: 52
Respuesta: Problema al crear un pequeño sistema php/mysql

hola

aqui:

Código PHP:

echo ("<table width='100%' border='0' cellspacing='0' cellpadding='0'>\n");
echo (
"<tr>\n");
echo(
"<td width='12%'><a href=modificarcoche.php?id=$id>Modificar</a></td>\n");
echo(
"<td width='12%'><a href=borrarcoches.php?id=$id>Borrar</a></td>\n");
echo (
"<td width='26%'><a href=coches.php?id=$id>$marca</a></td>\n");
echo (
"<td width='26%'>$modelo</a></td>\n");
echo (
"<td width='24%'>$fecha</a></td>\n");
echo (
"</table>\n"); 
envias la variable $id mediante GET

y en la siguiente pagina la recuperas con post y debarias cambiarlo a get
en Modificar registro (formulario):

es donde lo debes poner

$id = $_GET['id'];

y en el value del form hacer un echo de $id


Código PHP:


<?php

include ("header.php");
include (
"conectar.php");

$id $_GET['id'];
?>

<form name="form" action="modificarcoche2.php" method="post">
Seleccione la marca de su vehiculo:
<select name="marca">
<option value="alfaromeo">Alfa Romeo</option>
<option value="audi">Audi</option>
<option value="bmw">BMW</option>
</select>

<br/>
</h5>
<h5>
Indique el modelo:
<input name="modelo" type="text" size="45" />
</h5>
<h5>
Indique el color:
<input name="color" type="text" size="48" />
</h5>
Combustible:
<input name="combustible" type="radio" value="diesel" checked="checked" />Diesel
<input name="combustible" type="radio" value="gasolina" />Gasolina
</h5>
<h5>
Año matriculacion:
<input name="fecha" type="text" size="10" />
</h5>
<h5>
Precio:
<input type="text" name="precio" size="10" />
</h5>
<h5>
<input type="hidden" name="id" value="<? echo $id?>">
<input name="Enviar" type="submit" value="Enviar" />
</h5>
</form>

<?php
include ("footer.php");
?>