Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/01/2012, 00:09
wayward
(Desactivado)
 
Fecha de Ingreso: enero-2004
Mensajes: 136
Antigüedad: 20 años, 4 meses
Puntos: 0
Combobox dinamico

Hola a todos. Feliz año!!!!.

Mi problema es el siguiente:

Estoy realizado un combobox dynamico con tres tablas diferentes, y cuando lo ejecuto me sale Undifinied index. Me estoy volviendo loco, porque lo he realizado siguiendo todos los pasos de un tutorial, pero algo debo estar haciendo mal.

Lo he realizado con Dreamweaver.
El error surge en las lineas 75, 87, 91, 103, 107
Aqui os dejo el codigo:

Código PHP:
<?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_Recordset1 "SELECT * FROM autonomia";
$Recordset1 mysql_query($query_Recordset1$aluxbd) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);

$colname_Recordset2 "-1";
if (isset(
$_POST['ID_AUTONOMIA'])) {
  
$colname_Recordset2 $_POST['ID_AUTONOMIA'];
}
mysql_select_db($database_aluxbd$aluxbd);
$query_Recordset2 sprintf("SELECT ID_PROVINCIA, PROVINCIA FROM provincia WHERE ID_AUTONOMIA = %s"GetSQLValueString($colname_Recordset2"int"));
$Recordset2 mysql_query($query_Recordset2$aluxbd) or die(mysql_error());
$row_Recordset2 mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 mysql_num_rows($Recordset2);

$colname_Recordset3 "-1";
if (isset(
$_POST['ID_PROVINCIA'])) {
  
$colname_Recordset3 $_POST['ID_PROVINCIA'];
}
mysql_select_db($database_aluxbd$aluxbd);
$query_Recordset3 sprintf("SELECT ID_CIUDAD, CIUDAD FROM poblacion WHERE ID_PROVINCIA = %s"GetSQLValueString($colname_Recordset3"int"));
$Recordset3 mysql_query($query_Recordset3$aluxbd) or die(mysql_error());
$row_Recordset3 mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 mysql_num_rows($Recordset3);
?>
<!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=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <label for="a1"></label>
  <select name="a1" id="a1" onChange="submit()">
    <option value="" >Todas</option>
    <?php
do {  
?>
    <option value="<?php echo $row_Recordset1['ID_AUTONOMIA']?>"<?php if (!(strcmp($row_Recordset1['ID_AUTONOMIA'], $_POST['ID_AUTONOMIA'])))?>><?php echo $row_Recordset1['AUTONOMIA']?></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>
  <label for="a2"></label>
  <select name="a2" id="a2">
    <option value="" <?php if (!(strcmp(""$_POST['ID_PROVINCIA']))) {echo "selected=\"selected\"";} ?>>Todas</option>
    <?php
do {  
?>
    <option value="<?php echo $row_Recordset2['ID_PROVINCIA']?>"<?php if (!(strcmp($row_Recordset2['ID_PROVINCIA'], $_POST['ID_PROVINCIA']))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset2['PROVINCIA']?></option>
    <?php
} while ($row_Recordset2 mysql_fetch_assoc($Recordset2));
  
$rows mysql_num_rows($Recordset2);
  if(
$rows 0) {
      
mysql_data_seek($Recordset20);
      
$row_Recordset2 mysql_fetch_assoc($Recordset2);
  }
?>
  </select>
  <label for="a3"></label>
  <select name="a3" id="a3">
    <option value="" <?php if (!(strcmp(""$_POST['ID_CIUDAD']))) {echo "selected=\"selected\"";} ?>>Todas</option>
    <?php
do {  
?>
    <option value="<?php echo $row_Recordset3['ID_CIUDAD']?>"<?php if (!(strcmp($row_Recordset3['ID_CIUDAD'], $_POST['ID_CIUDAD']))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset3['CIUDAD']?></option>
    <?php
} while ($row_Recordset3 mysql_fetch_assoc($Recordset3));
  
$rows mysql_num_rows($Recordset3);
  if(
$rows 0) {
      
mysql_data_seek($Recordset30);
      
$row_Recordset3 mysql_fetch_assoc($Recordset3);
  }
?>
  </select>
</form>
</body>
</html>
<?php
mysql_free_result
($Recordset1);

mysql_free_result($Recordset2);

mysql_free_result($Recordset3);
?>