No funciona con el nuevo query, sigue sin mostrar cambios...
Esta claro que el error viene dado por la id en el query. Si simplemente borro el "where id='$id' ¿tendre problemas?
De todas maneras antes he comprobado la id en modificarcoche.php y llega correctamente pero si hago un "echo $id;" en modificarcoche2.php llega vacia...
modificarcoche.php
Código PHP:
<?php
include ("header.php");
include ("conectar.php");
$id = $_GET['id'];
echo $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");
?>
Código PHP:
<?php
include ("header.php");
include ("conectar.php");
$db="musicdai";
mysql_select_db($db,$conectar);
//Por si el servidor tiene desactivados los register globals----
$marca=$_POST['marca'];
$modelo=$_POST['modelo'];
$combustible=$_POST['combustible'];
$color=$_POST['color'];
$fecha=$_POST['fecha'];
$precio=$_POST['precio'];
$id=$_POST['id'];
//--------------------------------------------------------------
$result = mysql_query("update ocasion set marca='$marca', modelo='$modelo', combustible='$combustible', color='$color', fecha='$fecha', precio='$precio' where id='$id'") or die ("error en update:" .mysql_error());
//$result = mysql_query("update ocasion set marca='$marca', modelo='$modelo', combustible='$combustible', color='$color', fecha='$fecha', precio='$precio' where id='$id'", $conectar) or die ("error en update:" .mysql_error());
//$result = mysql_query("update ocasion set marca='$marca', modelo='$modelo', combustible='$combustible', color='$color', fecha='$fecha', precio='$precio' where id='$id'", $conectar);
echo "ID: $id";
echo "Actualizando los siguientes datos";
echo "<br /><br />";
echo "Marca: $marca";
echo "<br />";
echo "Modelo: $modelo";
echo "<br />";
echo "Combustible: $combustible";
echo "<br />";
echo "Color: $color";
echo "<br />";
echo "Fecha: $fecha";
echo "<br />";
echo "Precio: $precio";
echo "<br /><br />";
?>
<a href="buscador.php">Volver a buscar</a>
<?php
include ("footer.php");
?>
EDIT: Sin comillas simples peta