Ver Mensaje Individual
  #6 (permalink)  
Antiguo 21/01/2013, 14:30
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Consulta de Campos en tablas.

He puesto un NUM_DIR para identificar cada dirección:
Código:
 <div id="TabbedPanels2" class="TabbedPanels">
            <ul class="TabbedPanelsTabGroup">
              <li class="TabbedPanelsTab" tabindex="0">Dirección</li>
              <li class="TabbedPanelsTab" tabindex="0">Dirección 2</li>
              <li class="TabbedPanelsTab" tabindex="0">Dirección 3</li>
            </ul>
            <div class="TabbedPanelsContentGroup">
              <div class="TabbedPanelsContent">
              <table width="100%">
                  <tr>
                    <th scope="col">Calle</th>
                    <input name="NUM_DIR" type="hidden" size="" value="1" />
                    <th scope="col"><input name="calle" type="text" size="30"value="" /></th>
                    <th scope="col">Nº</th>
                    <th scope="col"><input name="numero" type="text" size="1"value="" />
                    EDF
                    <input name="edificio" type="text" size="1"value="" />
                    PTA
                    <input name="puerta" type="text" size="1"value="" />
                    PISO
                    <input name="piso" type="text" size="1"value="" />
                    LTA
                    <input name="letra" type="text" size="1"value="" /></th>
                </tr>
                     <tr>
                    <th scope="col">Localidad</th>
                    <th scope="col"><input name="poblacion" type="text" size="30" value="" /></th>
                    <th scope="col">Provincia</th>
                    <th scope="col"><input name="provincia" type="text" size="30" value="" /></th>
                  </tr>
                  <tr>
                  <th scope="col">Email</th>
                    <th scope="col"><input name="email" type="text" size="30" value=""/></th>
                </tr>
              </table>
              </div>
              <div class="TabbedPanelsContent"> 
               <table width="100%">
                  <tr>
                    <th scope="col">Calle</th>
                    <input name="NUM_DIR" type="hidden" size="" value="2" />
                    <th scope="col"><input name="calle" type="text" size="30"value="" /></th>
                    <th scope="col">Nº</th>
                    <th scope="col"><input name="numero" type="text" size="1"value="" />
                    EDF
                    <input name="edificio" type="text" size="1"value="" />
                    PTA
                    <input name="puerta" type="text" size="1"value="" />
                    PISO
                    <input name="piso" type="text" size="1"value="" />
                    LTA
                    <input name="letra" type="text" size="1"value="" /></th>
                </tr>
                     <tr>
                    <th scope="col">Localidad</th>
                    <th scope="col"><input name="poblacion" type="text" size="30" value="" /></th>
                    <th scope="col">Provincia</th>
                    <th scope="col"><input name="provincia" type="text" size="30" value="" /></th>
                  </tr>
                  <tr>
                  <th scope="col">Email</th>
                    <th scope="col"><input name="email" type="text" size="30" value=""/></th>
                </tr>
              </table>
              </div>
              <div class="TabbedPanelsContent"> 
               <table width="100%">
                  <tr>
                    <th scope="col">Calle</th>
                    <input name="NUM_DIR" type="hidden" size="" value="3" />
                    <th scope="col"><input name="calle" type="text" size="30"value="" /></th>
                    <th scope="col">Nº</th>
                    <th scope="col"><input name="numero" type="text" size="1"value="" />
                    EDF
                    <input name="edificio" type="text" size="1"value="" />
                    PTA
                    <input name="puerta" type="text" size="1"value="" />
                    PISO
                    <input name="piso" type="text" size="1"value="" />
                    LTA
                    <input name="letra" type="text" size="1"value="" /></th>
                </tr>
                     <tr>
                    <th scope="col">Localidad</th>
                    <th scope="col"><input name="poblacion" type="text" size="30" value="" /></th>
                    <th scope="col">Provincia</th>
                    <th scope="col"><input name="provincia" type="text" size="30" value="" /></th>
                  </tr>
                  <tr>
                  <th scope="col">Email</th>
                    <th scope="col"><input name="email" type="text" size="30" value=""/></th>
                </tr>
              </table>
              </div>
Pero claro al hacer el INSERT solo me insertaría una dirección no?

Código PHP:
$insertSQL sprintf("INSERT INTO dir_usuarios (id_aviso,calle,numero,edificio,puerta,piso,letra,localidad,provincia,NUM_DIR)VALUES (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s)",
                        
GetSQLValueString($_POST['id_aviso'], "int"),
                       
GetSQLValueString($_POST['calle'], "text"),
                       
GetSQLValueString($_POST['numero'], "text"),
                       
GetSQLValueString($_POST['edificio'], "text"),
                       
GetSQLValueString($_POST['puerta'], "text"),
                       
GetSQLValueString($_POST['piso'], "text"),
                       
GetSQLValueString($_POST['letra'], "text"),
                       
GetSQLValueString($_POST['localidad'], "text"),
                       
GetSQLValueString($_POST['provincia'], "text"),
                       
GetSQLValueString($_POST['NUM_DIR'], "text"));

  
mysql_select_db($database_conexion$conexion);
  
$usuarios mysql_query($insertSQL$conexion) or die(mysql_error());