Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/01/2015, 20:53
Alvasystem
 
Fecha de Ingreso: enero-2015
Ubicación: Ciudad Bolivar
Mensajes: 6
Antigüedad: 9 años, 3 meses
Puntos: 0
Pregunta problemas para insertar datos desde un menu desplegable dinamico en php

problemas para insertar datos desde un menu desplegable dinamico en php en una tabla necesito ayudaaaaa!!!

este es mi codigo:

index.php
<?php
$conexion = mysql_connect('localhost','root','');
$db = mysql_select_db("bd_sar",$conexion);
$consulta = "select nombres from sar_trabajador"; /*Aqui haces la query que quieras*/
$cursor = mysql_query("$consulta",$conexion);
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link rel="stylesheet" href="estilos.css" type="text/css">

</head>
<body topmargin="0" >
<p>&nbsp;</p>
<form name="form2" method="post" action="">
<table align="center" width="421">
<tr>
<td colspan="2" align="left">Datos del Producto </td>
</tr>
<tr>
<td width="164"><span class="Estilo5">
<label for="cedula">Codigo</label>
</span></td>
<td width="245"><input type="text" name="codigo" id="codigo" size="15" maxlength="30" /> </td>
</tr>

<tr>
<td><span class="Estilo5">
<label for="fecha_ingreso"></label>
Proveedor </span></td>
<td><label>
<?php
echo "<select>";
while($ver = mysql_fetch_array($cursor)){
echo "<option>".$ver['nombres']."</option>";
}
echo "</select>";
?>
</label></td>
</tr>

<tr>
<td height="26" colspan="2" align="center"><input type="reset" onClick="" name="cancelar" value="Limpiar" >
<span class="Estilo6">--- </span>
<input type="submit" name="registrarme" value="Ingresar" > </td>
</tr>
</table>
</form>
<p><br />
</p>
</body>
</html>

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

conexion.php
<?php
Function Conectarse()
{
if (!($enlace=mysql_connect("localhost","root")))
{
echo "Error conectando al Host.";
exit();
}
if (!mysql_select_db("bd_sar",$enlace))
{
echo "Error seleccionando la base de datos.";
exit();
}
return $enlace;
}
?>