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. He creado un combobox con Dreamweaver, y cuando lo ejecuto me sale una advertencia Undeninied Index at line 71. El combo funciona correctamente, pero ...
  #1 (permalink)  
Antiguo 18/01/2012, 08:58
(Desactivado)
 
Fecha de Ingreso: enero-2004
Mensajes: 136
Antigüedad: 20 años, 3 meses
Puntos: 0
Problema con combobox

Hola.

He creado un combobox con Dreamweaver, y cuando lo ejecuto me sale una advertencia Undeninied Index at line 71.

El combo funciona correctamente, pero la primera vez que se ejecuta aparece ese erro. ¿Que esta hecho mal?.

Un saludo.

<?php require_once('Connections/aluxbd.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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_aluxbd, $aluxbd);
$query_ID_AUTONOMIA = "SELECT * FROM autonomia";
$ID_AUTONOMIA = mysql_query($query_ID_AUTONOMIA, $aluxbd) or die(mysql_error());
$row_ID_AUTONOMIA = mysql_fetch_assoc($ID_AUTONOMIA);
$totalRows_ID_AUTONOMIA = mysql_num_rows($ID_AUTONOMIA);

$colname_prov = "-1";
if (isset($_POST['ID_AUTONOMIA'])) {
$colname_prov = $_POST['ID_AUTONOMIA'];
}
mysql_select_db($database_aluxbd, $aluxbd);
$query_prov = sprintf("SELECT * FROM provincia WHERE ID_AUTONOMIA = %s", GetSQLValueString($colname_prov, "int"));
$prov = mysql_query($query_prov, $aluxbd) or die(mysql_error());
$row_prov = mysql_fetch_assoc($prov);
$totalRows_prov = mysql_num_rows($prov);

$colname_poblacion = "-1";
if (isset($_POST['ID_PROVINCIA'])) {
$colname_poblacion = $_POST['ID_PROVINCIA'];
}
mysql_select_db($database_aluxbd, $aluxbd);
$query_poblacion = sprintf("SELECT * FROM poblacion WHERE ID_PROVINCIA = %s", GetSQLValueString($colname_poblacion, "int"));
$poblacion = mysql_query($query_poblacion, $aluxbd) or die(mysql_error());
$row_poblacion = mysql_fetch_assoc($poblacion);
$totalRows_poblacion = mysql_num_rows($poblacion);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="" method="post" enctype="multipart/form-data" name="combo" id="combo">
<label for="ID_AUTONOMIA"></label>
<select name="ID_AUTONOMIA" id="ID_AUTONOMIA" onChange="submit()">
<option value="" <?php if (!(strcmp("", $_POST['ID_AUTONOMIA']))) {echo "selected=\"selected\"";} ?>>Autonomia</option>
<?php
do {
?>
<option value="<?php echo $row_ID_AUTONOMIA['ID_AUTONOMIA']?>"<?php if (!(strcmp($row_ID_AUTONOMIA['ID_AUTONOMIA'], $_POST['ID_AUTONOMIA']))) {echo "selected=\"selected\"";} ?>><?php echo $row_ID_AUTONOMIA['AUTONOMIA']?></option>
<?php
} while ($row_ID_AUTONOMIA = mysql_fetch_assoc($ID_AUTONOMIA));
$rows = mysql_num_rows($ID_AUTONOMIA);
if($rows > 0) {
mysql_data_seek($ID_AUTONOMIA, 0);
$row_ID_AUTONOMIA = mysql_fetch_assoc($ID_AUTONOMIA);
}
?>
</select>
<label for="ID_PROVINCIA"></label>
<select name="ID_PROVINCIA" id="ID_PROVINCIA" onChange="submit()">
<option value="" <?php if (!(strcmp("", $_POST['ID_PROVINCIA']))) {echo "selected=\"selected\"";} ?>>Provincia</option>
<?php
do {
?>
<option value="<?php echo $row_prov['ID_PROVINCIA']?>"<?php if (!(strcmp($row_prov['ID_PROVINCIA'], $_POST['ID_PROVINCIA']))) {echo "selected=\"selected\"";} ?>><?php echo $row_prov['PROVINCIA']?></option>
<?php
} while ($row_prov = mysql_fetch_assoc($prov));
$rows = mysql_num_rows($prov);
if($rows > 0) {
mysql_data_seek($prov, 0);
$row_prov = mysql_fetch_assoc($prov);
}
?>
</select>
<select name="ID_CIUDAD" id="ID_CIUDAD">
<option value="" <?php if (!(strcmp("", $_POST['ID_CIUDAD']))) {echo "selected=\"selected\"";} ?>>Poblacion</option>
<?php
do {
?>
<option value="<?php echo $row_poblacion['ID_CIUDAD']?>"<?php if (!(strcmp($row_poblacion['ID_CIUDAD'], $_POST['ID_CIUDAD']))) {echo "selected=\"selected\"";} ?>><?php echo $row_poblacion['CIUDAD']?></option>
<?php
} while ($row_poblacion = mysql_fetch_assoc($poblacion));
$rows = mysql_num_rows($poblacion);
if($rows > 0) {
mysql_data_seek($poblacion, 0);
$row_poblacion = mysql_fetch_assoc($poblacion);
}
?>
</select>
</form>
</body>
</html>
<?php
mysql_free_result($ID_AUTONOMIA);

mysql_free_result($prov);

mysql_free_result($poblacion);
?>
  #2 (permalink)  
Antiguo 18/01/2012, 09:53
 
Fecha de Ingreso: septiembre-2007
Ubicación: PyRoot
Mensajes: 1.515
Antigüedad: 16 años, 7 meses
Puntos: 188
Respuesta: Problema con combobox


Etiquetas: combobox, html, mysql, sql
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 13:30.