Foros del Web » Programando para Internet » PHP »

Problema con combobox

Estas en el tema de Problema con combobox en el foro de PHP en Foros del Web. Hola amigos, Estoy haciendo un formulario que contiene un combobox que recoge las variables de una base de datos mysql. El problema lo tengo en ...
  #1 (permalink)  
Antiguo 26/01/2008, 18:30
Avatar de adexedl  
Fecha de Ingreso: julio-2005
Mensajes: 326
Antigüedad: 18 años, 9 meses
Puntos: 2
Problema con combobox

Hola amigos,

Estoy haciendo un formulario que contiene un combobox que recoge las variables de una base de datos mysql. El problema lo tengo en que por mucho que cambie de opción en este componente siempre me manda la misma variable.

Un ejemplo lo pueden ver aquí http://www.taxigrancanaria.com/contactar.php

Pongo el código de la página a ver si ven donde estoy cometiendo el error.

Saludos y mil gracias de antemano

Código PHP:
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}

mysql_select_db($database_taxigc$taxigc);
$query_Recordset1 "SELECT * FROM afiliados";
$Recordset1 mysql_query($query_Recordset1$taxigc) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Documento sin t&iacute;tulo</title>
<META NAME="description" CONTENT="">
<META NAME="keywords" CONTENT="">
<meta name="lang" content="es,sp,spanish,español">
<meta name="Revisit" content="7 days">
<meta name="robots" content="index,follow,all">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/estilos.css" rel="stylesheet" type="text/css">
<link href="css/menu.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="968" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="133" colspan="2" align="left" valign="top"><?php require_once('include-top.php'); ?></td>
  </tr>
  <tr>
    <td width="234" align="left" valign="top"><?php require_once('include-menu.php'); ?></td>
    <td width="734" align="center" valign="top"><table width="688" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="3"><img src="imagenes/img-contactar.jpg" alt="Contactar Taxi Gran Canaria" width="688" height="202"></td>
      </tr>
      <tr>
        <td height="37" colspan="3">&nbsp;</td>
      </tr>
      <tr>
        <td height="30" colspan="3" class="cabecera"><b>CONTACTAR </b></td>
      </tr>
      <tr>
        <td colspan="3"></td>
      </tr>
      <tr>
        <td colspan="3" class="texto">Si deseas contactar con Taxi Gran Canaria, puedes hacerlo mediante este sencillo formulario de contacto.</td>
      </tr>
      <tr>
        <td width="25">&nbsp;</td>
        <td width="348" align="left" valign="top"><form action="confirmacion.php?recordID=<?php echo $row_Recordset1['id_afiliado']; ?>" method="post" enctype="multipart/form-data" name="form1" id="form1">
          <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="textoformularios">Afiliado</td>
              <td align="left"><select name="email" class="textoformularios" id="email">
                <option value="">Seleccionar</option>
                <?php
do {  
?>
                <option value="<?php echo $row_Recordset1['email']?>"><?php echo $row_Recordset1['nombre']?></option>
                <?php
} while ($row_Recordset1 mysql_fetch_assoc($Recordset1));
  
$rows mysql_num_rows($Recordset1);
  if(
$rows 0) {
      
mysql_data_seek($Recordset10);
      
$row_Recordset1 mysql_fetch_assoc($Recordset1);
  }
?>
                                                                      </select></td>
            </tr>
            <tr>
              <td height="7" colspan="2" class="textoformularios"></td>
            </tr>
            <tr>
              <td width="100" class="textoformularios">Nombre</td>
              <td width="248" align="left"><input name="Nombre" type="text" class="cajaformulario" id="Nombre" size="20" /></td>
            </tr>
            <tr>
              <td height="7" colspan="2"></td>
            </tr>
            <tr>
              <td class="textoformularios">Apellidos</td>
              <td align="left"><input name="Apellidos" type="text" class="cajaformulario" id="Apellidos" size="20" /></td>
            </tr>
            <tr>
              <td height="7" colspan="2"></td>
            </tr>
            <tr>
              <td class="textoformularios">Email</td>
              <td align="left"><input name="Email" type="text" class="cajaformulario" id="Email" size="20" /></td>
            </tr>
            <tr>
              <td height="7" colspan="2"></td>
            </tr>
            <tr>
              <td class="textoformularios">Tel&eacute;fono</td>
              <td align="left"><input name="Telefono" type="text" class="cajaformulario" id="Telefono" size="20" /></td>
            </tr>
            <tr>
              <td height="7" colspan="2"></td>
            </tr>
            <tr>
              <td class="textoformularios">Consulta</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td height="7" colspan="2"></td>
            </tr>
            <tr>
              <td colspan="2" align="left"><textarea name="Consulta" cols="36" rows="5" class="cajaformularioareatexto" id="Consulta"></textarea></td>
            </tr>
            <tr>
              <td colspan="2">&nbsp;</td>
            </tr>
            <tr align="right">
              <td colspan="2"><table width="223" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="113" align="right"><input name="submit" type="submit" class="botonformulario" value="Borrar" />
                        <input name="submit" type="submit" class="botonformulario" value="Enviar" /></td>
                    <td width="87">&nbsp;</td>
                  </tr>
              </table></td>
            </tr>
          </table>
        </form></td>
        <td width="315" align="right" valign="top"><table width="288" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td class="titulocontactar"><b>DIRECCIONES EMAIL</b></td>
          </tr>
          <tr>
            <td height="15"></td>
          </tr>
          
          <tr>
            <td colspan="2">
            <ul class="enlacesemail">
            <li><a href="mailto:[email protected]" class="enlacesemail">[email protected]</a></li>
            <li><a href="mailto:[email protected]" class="enlacesemail">[email protected]</a></li>
            <li><a href="mailto:[email protected]" class="enlacesemail">[email protected]</a></li>
            </ul></td>
          </tr>
          <tr>
            <td height="10" align="left" valign="top"><img src="imagenes/px-verde.gif" width="100%" height="1"></td>
          </tr>
          <tr>
            <td>
            <ul class="enlacesemail">
            <li><a href="mailto:[email protected]" class="enlacesemail">[email protected]</a></li>
            </ul></td>
          </tr>
        </table></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="2" align="center" valign="bottom"><?php require_once('include-pie.php'); ?></td>
  </tr>
</table>
</body>

</html>
<?php
mysql_free_result
($Recordset1);
?>
__________________
Diseño Web Canarias
  #2 (permalink)  
Antiguo 27/01/2008, 07:13
Avatar de adexedl  
Fecha de Ingreso: julio-2005
Mensajes: 326
Antigüedad: 18 años, 9 meses
Puntos: 2
Re: Problema con combobox

Problema resuelto,

era un error a la hora de mandar la variable del formulario.

Saludos y gracias de todas formas
__________________
Diseño Web Canarias
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:49.