Ver Mensaje Individual
  #3 (permalink)  
Antiguo 24/08/2009, 21:57
Luis_1803
 
Fecha de Ingreso: agosto-2009
Ubicación: Peru
Mensajes: 10
Antigüedad: 14 años, 8 meses
Puntos: 1
Respuesta: Problema con combo box

disculpen, aqui van 2 codigos, los fundamentales, se deben crear la base de datos primero:
Este es el de registro del pedido:

<? include("funcion.php"); ?>
<html>
<head><title>Registrar Pedido</title></head>
<body bgcolor=green>
<center>
<font color=red face=Arial>Registrar pedido del cliente</font><br>
<table border=2>
<FORM ACTION="repped.php" METHOD=GET>
<tr><td>Fecha :</td><td> <INPUT TYPE="text" NAME="fecha" SIZE=20 MAXLENGTH=20></td>
<td>Pedido :</td><td> <INPUT TYPE="text" NAME="pedido" SIZE=20 MAXLENGTH=20></td></tr>
<tr><td>Cliente: </td><td> <select name=id> <option selected=''>Seleccione Cliente</option>
<? $cn=mysql_connect("localhost","root","fis");
if($cn)
{
mysql_select_db(estudiantes,$cn);
$sr=mysql_query("select * from cliente",$cn);
while($row=mysql_fetch_array($sr))
{
echo "<option value=".$row['nombres'].">".$row['nombres']."</option>";
}
echo "</select></td><td>Codigo: </td><td>".$nombre;

echo"</td></tr>";

}
else
{echo "Conexion fallida";}
?>

</td></tr>
<tr><td colspan>Total </td><td colspan><INPUT TYPE="text" NAME="monto" SIZE=28 MAXLENGTH=255></td><td colspan=2></td></tr>
<tr><td colspan=2>Estado </td></tr>

<tr><td colspan=2><input type=radio name='estado' value='pagado'>Pagado</td><td colspan=2><INPUT TYPE=reset VALUE=Limpiar></td></tr>
<tr><td colspan=2><input type=radio name='estado' value='pendiente'>Pendiente</td><td colspan=2><INPUT TYPE="submit" VALUE="Registrar"></td></tr>
</table>
<br><br>
<a href=inicio.php>Volver a inicio</a>
</center>
</FORM>
</body>
</html>

aqui va la funcion:

<?
$id=$_GET['id'];
$cn=mysql_connect("localhost","root","fis");
if($cn)
{
mysql_select_db("estudiantes",$cn);

if($id!="")
{
$sr=mysql_query("select nombres from cliente where idcliente=".'$id',$cn);
if ($row=sql_query($sr))
{
function mostrar($trabajo)
{$nombre=$row['nombres'];}
}
else
{echo "Error al mostrar nombres";}
}
else
{echo "Por favor, seleccione una opcion";
}
}
else {echo "Conexion fallida";}
?>

Última edición por Luis_1803; 24/08/2009 a las 22:22