Aiutatemi per favore

  • Creatore Discussione Creatore Discussione mfaffo
  • Data di inizio Data di inizio

mfaffo

Nuovo Utente
11 Giu 2007
3
0
0
Ho creato un formulARIO con php dove ci sono varie lista\menu che si attaulizzano automaticamente dipendendo dalla lista\menu anteriore,

Nazione -> provincia -> citta -> zona-> via

le liste\menu ( zona e via ) devono contenere un popup ( inserisci nuova zona) (inserisci nuova via).

Riassumendo, come pongo un pop-up nella lista\menu la quale si porta dietro la id lella lista\menu anteriore, e quando questa si apra, che inserta nella tabella mysql il dato che l'usuario srcive.


Per favore aiutatemi, sto impazzendo.

Grazie mille................. [email protected]
 
Ho creato un formulARIO con php dove ci sono varie lista\menu che si attaulizzano automaticamente dipendendo dalla lista\menu anteriore,

Nazione -> provincia -> citta -> zona-> via

le liste\menu ( zona e via ) devono contenere un popup ( inserisci nuova zona) (inserisci nuova via).

Riassumendo, come pongo un pop-up nella lista\menu la quale si porta dietro la id lella lista\menu anteriore, e quando questa si apra, che inserta nella tabella mysql il dato che l'usuario srcive.


Per favore aiutatemi, sto impazzendo.

Grazie mille................. [email protected]

Impazziamo di più noi perchè non si capisce nulla di quello che hai scritto
 
documento doc con php

Raga mi chiedevo se conoscete un modo, in php o in un altro linguaggio, con cui creare un documento .doc a partire da dati inseriti in un form html.
NB: E' necessario che sia .doc!!
Grazie a chi vorrà aiutarmi e ciao a tutti!!!
PIERPAOLO
 
avete ragione.
vi mando il formulario
PHP:
<?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">&nbsp;</td>
      <td width="16%">&nbsp;</td>
      <td colspan="2">&nbsp;</td>
      <td colspan="2">&nbsp;</td>
      <td colspan="3">&nbsp;</td>
      <td width="16%" colspan="-3">&nbsp;</td>
    </tr>
    <tr align="center" valign="middle">
      <td height="48">&nbsp;</td>
      <td>&nbsp;</td>
      <td colspan="5"><div align="center" class="Estilo1"></div>        <span class="Estilo5">Ubicacion Inmueble </span></td>
      <td width="6%" colspan="-3">&nbsp;</td>
      <td width="1%" colspan="-3">&nbsp;</td>
      <td colspan="-3">&nbsp;</td>
    </tr>
    <tr align="center" valign="middle">
      <td height="21">&nbsp;</td>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
      <td colspan="2">&nbsp;</td>
      <td colspan="3">&nbsp;</td>
      <td colspan="-3">&nbsp;</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%">&nbsp;</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">&nbsp;</td>
      <td colspan="-3"><p>&nbsp;
      </p>
        <p>&nbsp;</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>&nbsp; </td>
      <td height="42" colspan="3">&nbsp;</td>
      <td height="42">&nbsp;</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">&nbsp;</td>
      <td height="40">&nbsp;</td>
    </tr>
    <tr align="center" valign="middle">
      <td height="40" colspan="10">&nbsp;</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>&nbsp;</p>
    <table width="83%" border="0" align="center" id="dettaglio">
      <tr align="center" valign="middle">
        <td height="25">&nbsp;</td>
        <td colspan="3">&nbsp;</td>
        <td width="21%">&nbsp;</td>
        <td colspan="3">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr align="center" valign="middle">
        <td height="48">&nbsp;</td>
        <td width="1%">&nbsp;</td>
        <td width="1%">&nbsp;</td>
        <td width="18%">&nbsp;</td>
        <td colspan="2"><span class="Estilo5">Descricion Inmueble</span></td>
        <td width="1%">&nbsp;</td>
        <td width="1%">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr align="center" valign="middle">
        <td height="21">&nbsp;</td>
        <td colspan="3">&nbsp;</td>
        <td>&nbsp;</td>
        <td colspan="3">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</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&sup2; 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">&nbsp;</td>
        <td colspan="3">&nbsp;</td>
        <td>&nbsp;</td>
        <td colspan="3">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr align="center" valign="middle">
        <td height="44" colspan="10">&nbsp;</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);

?>
pagina che si apre cliccando Insertar Ciudad
PHP:
<?php require_once('Connections/conn.php'); ?>

<title>Insertar Ciudad</title>


<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#33CCFF" width="100%" height="76" bordercolorlight="#33CCFF" bordercolordark="#33CCFF">
  <tr>
    <td width="100%" height="76">
<p align="center"><span lang="es"><font color="#FF0000">
  Introduzca la Ciudad.</font></span></p>

<form method="post" action="" >
    <p align="center">
    <font color="#0000FF">Calle :</font> 
    <input type=text name=ciudad size=26 maxlength=50> <input name="Submit" type="submit" id="Submit" accesskey="E" value="Aceptar" onClick="window.close()">
</p>
    </form></td>
  </tr>
</table>
come trasporto la id della provicia scelta nel formulario ? ;) ciao e grazie
 
ma il problema è di passare una variabile da una finestra di popup aperta ad un altra pagina?
 
ciao Metalgemini ,
grazie per rispondermi.

Si, ti mando la finestra che si apre con il popup

ins_ciudad
PHP:
<?php require_once('Connections/conn.php'); ?>

<title>Insertar Ciudad</title>


<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#33CCFF" width="100%" height="76" bordercolorlight="#33CCFF" bordercolordark="#33CCFF">
  <tr>
    <td width="100%" height="76">
	<p align="center"><span lang="es"><font color="#FF0000">
	  Introduzca la Ciudad.</font></span></p>

	<form method="post" action="" >
    <p align="center">
    <font color="#0000FF">Calle :</font> 
    <input type=text name=ciudad size=26 maxlength=50> <input name="Submit" type="submit" id="Submit" accesskey="E" value="Aceptar" onClick="window.close()">
	</p>
    </form></td>
  </tr>
</table>
 
Tieni sostituisci con questo:
HTML:
<html>
<head>
<title>Popup</title>
<script type=text/javascript>
function passaid(){
                    var id = document.modulo.ciudad.value;
                    var url = ("pagina2.htm?id=" + id);
                    window.opener.location.href=url;
                    window.close();
                    return true;
                  }
</script>
</head>
    <form method="post" action="" onSubmit="return passaid()" name="modulo"> 
    <p align="center"> 
    <font color="#0000FF">Calle :</font> 
    <input type=text name=ciudad size=26 maxlength=50> <input name="Submit" type="submit" id="Submit" accesskey="E" value="Aceptar"> 
    </p> 
    </form>
</html>
L'ho provato e funge:)
 
Ultima modifica:

Discussioni simili