Jump to content


Photo

Tabela Dinâmica


  • Faça o login para participar
6 replies to this topic

#1 weslley clyton

weslley clyton

    Turista

  • Usuários
  • 40 posts
  • Sexo:Não informado

Posted 05/06/2010, 11:46

Ola Pessoal..

Seguinte, eu tenho aq uma tabela dinâmica funcionando perfeitamente, mas meu problema é o seguinte, quando eu vou dar o submit no form e mandar os dados pro php para serem gravados do BD eu não sei como pegar os dados dos inputs, pois não sei o nome dos mesmos.


Aqui a função juntamente com a tabela:


    <script>

		var d = document ;
        window.onload = function(){
                
				d.getElementById( 'firstLink' ).onclick = function(){ removerTr( 1 ) }
        
                d.getElementById( 'add' ).onclick = function(){
                        var oTable = d.getElementById( 'tabela' ) ;
                        var newTr  = oTable.insertRow( -1 ) ;
                        
                        newTr.setAttribute( 'id' , 'row' + oTable.rows.length ) ;
                        newTr.insertCell(0).appendChild( getLinkExcluir( oTable.rows.length ) ) ;
                        newTr.insertCell(1).appendChild( getInput() ) ;
						newTr.insertCell(2).appendChild( getInput() ) ;
						newTr.insertCell(3).appendChild( getInput() ) ;
						newTr.insertCell(4).appendChild( getInput() ) ;
                }
        }
        
        function getLinkExcluir( rowId )
        {
                var oA = d.createElement( 'a' ) ;
                oA.setAttribute( 'href' , '#' ) ;
                oA.innerHTML =  'excluir' ;
                oA.onclick = function(){ removerTr( rowId ) ; }
                return oA ;
        }
        
        function getInput()
        {
                var oInput = d.createElement( 'input' ) ;
                oInput.setAttribute( 'name' , 'inputs[]' ) ;
				return oInput ;
        }
        
        function removerTr( rowId )
        {
                var iRow = d.getElementById( 'row' + rowId ).rowIndex ;
                d.getElementById( 'tabela' ).deleteRow( iRow ) ;
                return false ;
        }


</script>



e Aqui o Html:


   <form>                
	<table id='tabela'>
       <tr id='row1'>                        
       	<td><a id='firstLink' href='#'>excluir</a></td>
        <td>
        	<input type="text" name='inputs[]'>                         
       </td>                  
      </tr>                
    </table>                
    <div><input type="submit"></div>        
</form>        
<button id='add' type='button'>Adicionar</button>



como veêm ele usa um array para guardar o nome de cada linha adicionada, mas eu não estou conseguindo visualizar este nome, quando eu der o submit como é q eu vo pegar la no php os nomes dos inputs por exemplo: $nome = $_POST['??????'];

#2 André Manoel

André Manoel

    Doutor

  • Usuários
  • 996 posts
  • Sexo:Masculino
  • Localidade:Brasilia

Posted 07/06/2010, 17:24

Justamente pelos inputs...

Quando os dados forem enviados para a página PHP que vai processar a solicitação
Você só vai usar o array que será enviado com todos os dados.

Quando você usa colchetes nos nomes de algum campo de formulário html... ele cria um array no envio...

Faz um teste para você ver como é interessante...

Na pagina PHP você coloca isso

<?php 
  echo "<pre>";
  print_r( $_POST );
  echo "</pre>";
?>

Você verá que será mandado um array com todos os dados da tabela...

(y)
Iniciando na Ajuda On line...

Posted Image Meu post lhe ajudou? Reputar/votar é uma das formas de agradecer.

#3 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 23/09/2017, 05:41

Generic Secure Stendra Cod Accepted Internet Overseas Store Exeter viagra cialis How To Buy Viagra On Line Cheap Viagra Soft Kaufen Interaction Amoxicillin Methocarbam Viagra Sale Online Secure Ordering Provera Order cialis Cephalexin Indications And Uses
Priligyonlineusa cialis Cialis 20mg Forum
Viagra Prezzo Farmacia
Low Price Viagra 100mg <a href=http://cialtobuy.com>cialis</a> Amoxicillin Gg 250 848

#4 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 23/09/2017, 13:54

Online Apotheke Kamagra Kaufen When Does Cephalexin Expire Prices Of Viagra cheap cialis Zithromax Wound Infection Amoxicillin Liquid Thrush Tongue

#5 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 14/10/2017, 09:00

Pediatric Dosage Of Amoxicillin buy viagra Is Generic Priligy Safe Propecia Decadencia De Pelo Cialis Tablettes
Buy Qsymia Without A Prescription Cost Of Cialis viagra online Priligy Scadenza Fedex Levaquin Internet Free Shipping Amex Mtabs Scam

#6 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 31/10/2017, 19:10

Keflex Manufacturere Precio De Cialis Generico En Aguascalientes viagra online prescription Ivermectin No Prescription
Cialis Homeopathie Viagra Quoi Sert Viagra Grenoble cialis online Once A Day Amoxicillin Actos
Topical Finasteride Propecia viagra Albuterol Inhaler Without A Script Cialis Cout Commander Levitra

#7 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 27/11/2017, 16:05

What Is Viagra Jelly viagra Synthriod Without A Script Cheap Cod Hydrochlorothiazide Hct Mastercard Accepted In Us Cialais
Propecia Cost Buy Kamagra Oral Jelly Paris Order Xenical Generic Online viagra Propecia Eficacia Foliculo Piloso
Viagra Bestellen Online levitra and cialis online Eolica Al Propecia Bentyl Medication Farmaco Generico Cialis




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq