Yo para almacenar datos de un combo o lista/menú empleé dreamweaver, o sea lo que hice con dreamweaver fue crear los juegos de registros que necesitaba con las consultas que me hacian falta y listo hice luego las vinculaciones y todo salío bien. Aquí te pongo el código para que lo analices ya que seguramente soy más nuevo que tú en esto del php, te darás cuanta ya que empleo dreamweaver para que me facilite un poco las cosas, sé que estos programas dejan un poco de churre en el código pero bueno uno lo acomada y lo adapta.
A mí me fue bien, revisa si quieres aquí está el código:
Código PHP:
<?php require_once('Connections/prueba123.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO servicios (categoria, entidad, nombre, descripcion, foto) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['categoria'], "int"),
GetSQLValueString($_POST['entidad'], "int"),
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($_POST['foto'], "text"));
mysql_select_db($database_prueba123, $prueba123);
$Result1 = mysql_query($insertSQL, $prueba123) or die(mysql_error());
$insertGoTo = "Insertado OK.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_prueba123, $prueba123);
$query_Jr_categorias = "SELECT * FROM categorias";
$Jr_categorias = mysql_query($query_Jr_categorias, $prueba123) or die(mysql_error());
$row_Jr_categorias = mysql_fetch_assoc($Jr_categorias);
$totalRows_Jr_categorias = mysql_num_rows($Jr_categorias);
mysql_select_db($database_prueba123, $prueba123);
$query_Jr_Entidades = "SELECT * FROM entidades";
$Jr_Entidades = mysql_query($query_Jr_Entidades, $prueba123) or die(mysql_error());
$row_Jr_Entidades = mysql_fetch_assoc($Jr_Entidades);
$totalRows_Jr_Entidades = mysql_num_rows($Jr_Entidades);
//mysql_free_result($Jr_categorias);
//mysql_free_result($Jr_Entidades);
?>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Categoria:</td>
<td><select name="categoria" size="1" id="categoria" title="">
<?php
do {
?><option value="<?php echo $row_Jr_categorias['idcategorias']?>"><?php echo $row_Jr_categorias['nombre']?></option>
<?php
} while ($row_Jr_categorias = mysql_fetch_assoc($Jr_categorias));
$rows = mysql_num_rows($Jr_categorias);
if($rows > 0) {
mysql_data_seek($Jr_categorias, 0);
$row_Jr_categorias = mysql_fetch_assoc($Jr_categorias);
}
?>
</select>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Entidad:</td>
<td><select name="entidad" size="1" id="entidad" title="<?php echo $row_Jr_Entidades['nombre']; ?>">
<?php
do {
?><option value="<?php echo $row_Jr_Entidades['identidad']?>"><?php echo $row_Jr_Entidades['nombre']?></option><?php
} while ($row_Jr_Entidades = mysql_fetch_assoc($Jr_Entidades));
$rows = mysql_num_rows($Jr_Entidades);
if($rows > 0) {
mysql_data_seek($Jr_Entidades, 0);
$row_Jr_Entidades = mysql_fetch_assoc($Jr_Entidades);
}
?>
</select>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Nombre:</td>
<td><input type="text" name="nombre" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Descripcion:</td>
<td><input type="text" name="descripcion" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Foto:</td>
<td><input type="file" name="foto" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Insertar registro"></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
<?php
mysql_free_result($Jr_categorias);
mysql_free_result($Jr_Entidades);
?>
Salu2 y espero haberte ayudado en algo.