lo hice tal cual me dijiste, pero me aparece la pantalla en blanco O.o
asi quedo el codigo, no hay nada mal o si?
Código PHP:
<?php require_once('dboptchile.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_dboptchile, $dboptchile);
$query_regiones = "SELECT * FROM regiones";
$regiones = mysql_query($query_regiones, $adboptchile) or die(mysql_error());
$row_regiones = mysql_fetch_assoc($regiones);
$totalRows_regiones = mysql_num_rows($regiones);
?>
<!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>Documento sin título</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script language="JavaScript" type="text/JavaScript">
$(document).ready(function(){
$("#select1").change(function(event){
var id = $("#select1").find(':selected').val();
$("#select2").load('comunas.php?id='+id);
});
});
</script>
</head>
<body>
<select name="select1" id="select1">
<option value="0">Elija</option>
<?php
do {
?>
<option value="<?php echo $row_regiones['region_id']?>"><?php echo $row_regiones['region_nombre']?></option>
<?php
} while ($row_regiones = mysql_fetch_assoc($regiones));
$rows = mysql_num_rows($comunas);
if($rows > 0) {
mysql_data_seek($regiones, 0);
$row_comunas = mysql_fetch_assoc($regiones);
}
?>
</select>
<select name="select2" id="select2">
</select>
</body>
</html>
<?php
mysql_free_result($regiones);
?>
mmmmmm he modificado algunas cosas, pero no mejora...