<?php require_once('Connections/conn.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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO anuncios (gestione, tipo, m_int, region, provincia, ciudad, zona, calle, ) VALUES ( %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['gestione'], "text"),
GetSQLValueString($_POST['tipo'], "text"),
GetSQLValueString($_POST['m_int'], "text"),
GetSQLValueString($_POST['region'], "text"),
GetSQLValueString($_POST['provincia'], "text"),
GetSQLValueString($_POST['ciudad'], "text"),
GetSQLValueString($_POST['zona'], "text"),
GetSQLValueString($_POST['calle'], "text"));
mysql_select_db($database_conn, $conn);
$Result1 = mysql_query($insertSQL, $conn) or die(mysql_error());
$insertGoTo = "ver_form.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<?php
//NeXTenesio Special List Recordset
mysql_select_db($database_conn, $conn);
$query_Regiones = "SELECT * FROM regiones ORDER BY region ASC";
$Regiones = mysql_query($query_Regiones, $conn) or die(mysql_error());
$row_Regiones = mysql_fetch_assoc($Regiones);
$totalRows_Regiones = mysql_num_rows($Regiones);
//End NeXTenesio Special List Recordset
//NeXTenesio Special List Recordset
$colname_Provincias = "-1";
if (isset($_POST['id_region'])) {
$colname_Provincias = $_POST['id_region'];
}
mysql_select_db($database_conn, $conn);
$query_Provincias = sprintf("SELECT id_provincia, provincia FROM provincias WHERE id_region = '%s' ORDER BY provincia ASC", $colname_Provincias);
$Provincias = mysql_query($query_Provincias, $conn) or die(mysql_error());
$row_Provincias = mysql_fetch_assoc($Provincias);
$totalRows_Provincias = mysql_num_rows($Provincias);
//End NeXTenesio Special List Recordset
//NeXTenesio Special List Recordset
$colname_Ciudades = "-1";
if (isset($_POST['id_provincia'])) {
$colname_Ciudades = $_POST['id_provincia'];
}
mysql_select_db($database_conn, $conn);
$query_Ciudades = sprintf("SELECT id_ciudad, ciudad FROM ciudades WHERE id_provincia = '%s' ORDER BY ciudad ASC", $colname_Ciudades);
$Ciudades = mysql_query($query_Ciudades, $conn) or die(mysql_error());
$row_Ciudades = mysql_fetch_assoc($Ciudades);
$totalRows_Ciudades = mysql_num_rows($Ciudades);
//End NeXTenesio Special List Recordset
//NeXTenesio Special List Recordset
$colname_Zonas = "-1";
if (isset($_POST['id_ciudad'])) {
$colname_Zonas = $_POST['id_ciudad'];
}
mysql_select_db($database_conn, $conn);
$query_Zonas = sprintf("SELECT id_zona, zona FROM zonas WHERE id_ciudad = '%s' ORDER BY zona ASC", $colname_Zonas);
$Zonas = mysql_query($query_Zonas, $conn) or die(mysql_error());
$row_Zonas = mysql_fetch_assoc($Zonas);
$totalRows_Zonas = mysql_num_rows($Zonas);
//End NeXTenesio Special List Recordset
//NeXTenesio Special List Recordset
$colname_Calles = "-1";
if (isset($_POST['id_zona'])) {
$colname_Calles = $_POST['id_zona'];
}
mysql_select_db($database_conn, $conn);
$query_Calles = sprintf("SELECT id_calle, calle FROM calles WHERE id_zona = '%s' ORDER BY calle ASC", $colname_Calles);
$Calles = mysql_query($query_Calles, $conn) or die(mysql_error());
$row_Calles = mysql_fetch_assoc($Calles);
$totalRows_Calles = mysql_num_rows($Calles);
//End NeXTenesio Special List Recordset
?>
<form name="form1" method="post" action="">
<table width="83%" border="0" align="center">
<tr align="center" valign="middle">
<td height="21"> </td>
<td width="16%"> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="3"> </td>
<td width="16%" colspan="-3"> </td>
</tr>
<tr align="center" valign="middle">
<td height="48"> </td>
<td> </td>
<td colspan="5"><div align="center" class="Estilo1"></div> <span class="Estilo5">Ubicacion Inmueble </span></td>
<td width="6%" colspan="-3"> </td>
<td width="1%" colspan="-3"> </td>
<td colspan="-3"> </td>
</tr>
<tr align="center" valign="middle">
<td height="21"> </td>
<td> </td>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="3"> </td>
<td colspan="-3"> </td>
</tr>
<tr align="center" valign="middle">
<td width="10%" height="48"><strong>Region:</strong></td>
<td colspan="2"><select name="id_region" id="id_region" onChange="submit()">
<option value="" <?php if (!(strcmp("", $_POST['id_region']))) {echo "SELECTED";} ?>>Seleccionar</option>
<?php
do {
?>
<option value="<?php echo $row_Regiones['id_region']?>"<?php if (!(strcmp($row_Regiones['id_region'], $_POST['id_region']))) {echo "SELECTED";} ?>><?php echo $row_Regiones['region']?></option>
<?php
} while ($row_Regiones = mysql_fetch_assoc($Regiones));
$rows = mysql_num_rows($Regiones);
if($rows > 0) {
mysql_data_seek($Regiones, 0);
$row_Regiones = mysql_fetch_assoc($Regiones);
}
?>
</select></td>
<td width="19%"> </td>
<td colspan="2"><strong>Provincia:</strong></td>
<td colspan="4"><select name="id_provincia" id="select2" onChange="submit()">
<option value="" <?php if (!(strcmp("", $_POST['id_provincia']))) {echo "SELECTED";} ?>>Seleccionar</option>
<?php
do {
?>
<option value="<?php echo $row_Provincias['id_provincia']?>"<?php if (!(strcmp($row_Provincias['id_provincia'], $_POST['id_provincia']))) {echo "SELECTED";} ?>><?php echo $row_Provincias['provincia']?></option>
<?php
} while ($row_Provincias = mysql_fetch_assoc($Provincias));
$rows = mysql_num_rows($Provincias);
if($rows > 0) {
mysql_data_seek($Provincias, 0);
$row_Provincias = mysql_fetch_assoc($Provincias);
}
?>
</select></td>
</tr>
<tr align="center" valign="middle">
<td height="64"><strong>Ciudad:</strong></td>
<td colspan="2">
<p>
<select name="id_ciudad" id="id_ciudad" onChange="submit()">
<option value="" <?php if (!(strcmp("", $_POST['id_ciudad']))) {echo "SELECTED";} ?>>Seleccionar</option>
<?php
do {
?>
<option value="<?php echo $row_Ciudades['id_ciudad']?>"<?php if (!(strcmp($row_Ciudades['id_ciudad'], $_POST['id_ciudad']))) {echo "SELECTED";} ?>><?php echo $row_Ciudades['ciudad']?></option>
<?php
} while ($row_Ciudades = mysql_fetch_assoc($Ciudades));
$rows = mysql_num_rows($Ciudades);
if($rows > 0) {
mysql_data_seek($Ciudades, 0);
$row_Ciudades = mysql_fetch_assoc($Ciudades);
}
?>
</select>
</p> </td>
<td colspan="3"><a href="#" target="reminder" onClick='window.open("ins_ciudad.php","reminder","width=250,height=160,scrollbars=0,resizable=0"); return false;'>Insertar Ciudad </a></td>
<td colspan="3"> </td>
<td colspan="-3"><p>
</p>
<p> </p></td>
</tr>
<tr align="center" valign="middle">
<td height="42"><strong>Zona:</strong> </td>
<td height="42" colspan="2"><select name="id_zona" id="select4" onChange="submit()" >
<option value="" <?php if (!(strcmp("", $_POST['id_zona']))) {echo "SELECTED";} ?>>Seleccionar</option>
<?php
do {
?>
<option value="<?php echo $row_Zonas['id_zona']?>"<?php if (!(strcmp($row_Zonas['id_zona'], $_POST['id_zona']))) {echo "SELECTED";} ?>><?php echo $row_Zonas['zona']?></option>
<?php
} while ($row_Zonas = mysql_fetch_assoc($Zonas));
$rows = mysql_num_rows($Zonas);
if($rows > 0) {
mysql_data_seek($Zonas, 0);
$row_Zonas = mysql_fetch_assoc($Zonas);
}
?>
</select></td>
<td height="42" colspan="3"><a href="#" target="reminder" onClick='window.open("ins_zona.php","reminder","width=250,height=160,scrollbars=0,resizable=0"); return false;'>Insertar Zona</a> </td>
<td height="42" colspan="3"> </td>
<td height="42"> </td>
</tr>
<tr align="center" valign="middle">
<td height="40"><strong>Calle:</strong> </td>
<td height="40" colspan="2"><select name="id_calle" id="select5" onChange="submit()">
<option value="" <?php if (!(strcmp("", $_POST['id_calle']))) {echo "SELECTED";} ?>>Seleccionar</option>
<?php
do {
?>
<option value="<?php echo $row_Calles['id_calle']?>"<?php if (!(strcmp($row_Calles['id_calle'], $_POST['id_calle']))) {echo "SELECTED";} ?>><?php echo $row_Calles['calle']?></option>
<?php
} while ($row_Calles = mysql_fetch_assoc($Calles));
$rows = mysql_num_rows($Calles);
if($rows > 0) {
mysql_data_seek($Calles, 0);
$row_Calles = mysql_fetch_assoc($Calles);
}
?>
</select></td>
<td height="40" colspan="3"><a href="#" target="reminder" onClick='window.open("ins_calle.php","reminder","width=250,height=160,scrollbars=0,resizable=0"); return false;'>Insertar Calle </a> </td>
<td height="40" colspan="3"> </td>
<td height="40"> </td>
</tr>
<tr align="center" valign="middle">
<td height="40" colspan="10"> </td>
</tr>
</table>
<hr width="83%" size="7" noshade>
</form>
<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form2" id="form2">
<p> </p>
<table width="83%" border="0" align="center" id="dettaglio">
<tr align="center" valign="middle">
<td height="25"> </td>
<td colspan="3"> </td>
<td width="21%"> </td>
<td colspan="3"> </td>
<td> </td>
<td> </td>
</tr>
<tr align="center" valign="middle">
<td height="48"> </td>
<td width="1%"> </td>
<td width="1%"> </td>
<td width="18%"> </td>
<td colspan="2"><span class="Estilo5">Descricion Inmueble</span></td>
<td width="1%"> </td>
<td width="1%"> </td>
<td> </td>
<td> </td>
</tr>
<tr align="center" valign="middle">
<td height="21"> </td>
<td colspan="3"> </td>
<td> </td>
<td colspan="3"> </td>
<td> </td>
<td> </td>
</tr>
<tr align="center" valign="middle">
<td width="13%" height="48"><span class="Estilo2">Gestion : </span></td>
<td colspan="3"><strong>
<select name="gestione">
<option>Vendo</option>
<option>Alquilo</option>
<option>Traspaso</option>
</select>
</strong></td>
<td><div align="right"><span class="Estilo2">Tipo Vivienda :
</span></div></td>
<td colspan="3"><strong>
<select name="tipo">
<option>Apartamento</option>
<option>Casa</option>
<option>Piso</option>
<option>Atico</option>
</select>
</strong></td>
<td width="16%"><span class="Estilo2">M² Interno : </span></td>
<td width="7%"><input name="m_int" type="text" id="m_int" size="6" maxlength="6" /></td>
</tr>
<tr align="center" valign="middle">
<td height="49"> </td>
<td colspan="3"> </td>
<td> </td>
<td colspan="3"> </td>
<td> </td>
<td> </td>
</tr>
<tr align="center" valign="middle">
<td height="44" colspan="10"> </td>
</tr>
</table>
<hr width="83%" size="7" noshade>
<p>
<input name="region" type="hidden" id="region" value="<?php echo $_POST['id_region'];?>">
<input name="provincia" type="hidden" id="provincia" value="<?php echo $_POST['id_provincia'];?>">
<input name="ciudad" type="hidden" id="ciudad" value="<?php echo $_POST['id_ciudad'];?>">
<input name="zona" type="hidden" id="zona" value="<?php echo $_POST['id_zona'];?>">
<input name="calle" type="hidden" id="calle" value="<?php echo $_POST['id_calle'];?>">
<label><input name="Submit" type="submit" id="Submit" accesskey="E" value="Enviar" />
</label>
<input type="hidden" name="MM_insert" value="form2">
</form>
<p>
<p>
<?php
mysql_free_result($Regiones);
mysql_free_result($Provincias);
mysql_free_result($Ciudades);
mysql_free_result($Zonas);
mysql_free_result($Calles);
?>