Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/07/2008, 09:06
Avatar de colote
colote
 
Fecha de Ingreso: julio-2008
Ubicación: Rosario - Santa Fe - Argentina
Mensajes: 729
Antigüedad: 15 años, 9 meses
Puntos: 8
Necesito hacer un menu Desplegable

Hola a todos en forosdelweb !!!!!

Este es mi 1º post aca :D

El tema es el siguiente, soy nuevo con PHP y mysql, lo que necesito hacer es un menu desplegable para un formulario de modificacion, pero que me muestre los registros que tengo ingresado en una tabla asi con un click lo puedo seleccionar y luego modificar.
Ahora lo uso de la siguiente forma: ingreso un codigo, me lo muestra en pantalla y lo puedo modificar seleccionando los campos.

Aca les dejo los 3 archivos en php para la modificacion ( Si existe alguna otra forma de hacer un form de modificacion acepto propuestas):

Desde ya muchas Gracias.


modif_clientes1.php
<html>
<head>
<title>MODIFICACION CLIENTES</title>
</head>
<body>
<h1>BUSCAR CLIENTE A MODIFICAR</h1>

<form action="modif_clientes2.php" method="post">
Ingrese el Codigo a Modificar:
<input type="text" name="codigo">

<br>
<input type="submit" value="BUSCAR">
<input type="submit" value="VOLVER" onclick = "self.location.href = 'inicio.php'"/>
</form>
</body>
</html>

------------------------------------------------------------------------------------------------------------

modif_clientes2.php
<html>
<head>
<title>MODIFICACION CLIENTES</title>
</head>
<body>
<h1>MODIFICACION DE CLIENTES POR NOMBRE</h1>
<?php
$conexion=mysql_connect("localhost","root","xxxxxx ") or
die("Problemas en la conexion");

mysql_select_db("empresa",$conexion) or
die("Problemas en la selección de la base de datos");

$registros=mysql_query("select * from clientes
where codigo='$_REQUEST[codigo]'",$conexion) or
die("Problemas en el select:".mysql_error());


if ($reg=mysql_fetch_array($registros))
{
?>
<form action="modif_clientes3.php" method="post">

Ingrese Nuevo Nombre:
<input type="text" name="nombrenuevo" value="<?php echo $reg['nombre'] ?>">
Ingrese Nuevo Cuit:
<input type="text" name="cuitnuevo" value="<?php echo $reg['cuit']?>">
Ingrese Nuevo Domicilio:
<input type="text" name="domicilionuevo" value="<?php echo $reg['domicilio'] ?>">
Ingrese Nueva Provincia:
<input type="text" name="provincianueva" value="<?php echo $reg['provincia']?>">



<input type="hidden" name="nombreviejo" value="<?php echo $reg['nombre'] ?>">
<input type="hidden" name="cuitviejo" value="<?php echo $reg['cuit'] ?>">
<input type="hidden" name="domicilioviejo" value="<?php echo $reg['domicilio'] ?>">
<input type="hidden" name="provinciavieja" value="<?php echo $reg['provincia'] ?>">



<input type="submit" value="MODIFICAR">

</form>
<?php

}
else
echo "No existe Cliente con ese nombre";
?>

<input type="submit" value="VOLVER" onclick = "self.location.href = 'inicio.php'" />
</body>
</html>


------------------------------------------------------------------------------------------------------------


modif_clientes3.php

<html>
<head>
<title>MODIFICACION CLIENTES</title>
</head>
<body>

<h1>MODIFICACION DE CLIENTES POR NOMBRE</h1>

<?php
$conexion=mysql_connect("localhost","root","xxxxxx ") or
die("Problemas en la conexion");

mysql_select_db("empresa",$conexion) or
die("Problemas en la selección de la base de datos");

$registros=mysql_query("update clientes
set nombre='$_REQUEST[nombrenuevo]', cuit='$_REQUEST[cuitnuevo]', domicilio='$_REQUEST[domicilionuevo]',provincia='$_REQUEST[provincianueva]'
where nombre='$_REQUEST[nombreviejo]'",$conexion) or
die("Problemas en el select:".mysql_error());


echo "El Cliente fue modificado con exito";
?>
</body>

<input type="submit" value="VOLVER" onclick = "self.location.href = 'modif_clientes1'" />
</html>