Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script type="text/javascript">
- function adicionarUsuario()
- {
- var local = document.getElementById('usuario');
- var tblBody = local.tBodies[0];
- var newRow = tblBody.insertRow(-1);
- var indice = newRow.rowIndex;
- var newCell0 = newRow.insertCell(0);
- newCell0.innerHTML = '<td>Nome: <input type="text" name="nome[' + indice + ']" size="20" maxlenght="30" /></td>';
- var newCell2 = newRow.insertCell(1);
- newCell2.innerHTML = '<td>Externo: <input type="checkbox" name="externo[' + indice + ']" /></td>';
- }
- </script>
- </head>
- <body>
- <form method="post" action="?acao=salva">
- <table id="usuario">
- <tbody>
- <tr>
- <td>Nome: <input type='text' name='nome[0]' size='20' maxlenght='30'></td>
- <td>Externo: <input type='checkbox' name='externo[0]'></td>
- </tr>
- </tbody>
- </table>
- <p><input type="button" value="+1 Usuário" onclick="adicionarUsuario();" /></p>
- <p><input type="submit" value="Enviar" /></p>
- </form>
- <?php
- $acao = $_GET['acao'];
- if ($acao == 'salva')
- {
- $nome = $_POST['nome']; // Recebemos os nomes
- $externo = $_POST['externo']; // E os que foram marcados
- echo '<pre>';
- print_r( $nome ); // Podemos visualizar como ficou nosso array de nomes
- print_r( $externo ); // E aqui como ficou nosso array de marcados
- echo '</pre>';
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement