Ver Mensaje Individual
  #7 (permalink)  
Antiguo 26/04/2007, 16:01
Avatar de @ndreX!
@ndreX!
 
Fecha de Ingreso: abril-2007
Mensajes: 161
Antigüedad: 17 años
Puntos: 4
Re: necesito ayuda con arreglos y formulario

Es logico...

No vuelves a ocupar nombre[] otra vez....

Nose si te sirva así, pero la idea del arreglo de campos es esta:

Código PHP:
    <html>
    <head>
        <title>    </title>
    </head>
    <body>
        <form action="b2.php" method="post" name='form'>
            <table border='1'>
                <tr>
                    <td>nombre</td>
                    <td>apellido</td>
                    <td>fono</td>
                </tr>
                    <?php
                        
if (count($_POST['nombre'])>0){
                            
$largo=count($_POST['nombre']);
                            echo 
"$largo";
                            for(
$i=0;$i<count($_POST['nombre']);$i++){
                                echo 
"<td>".$_POST['nombre'][$i].'<br /></td>';
                            }
                        }
                        else
                            echo 
"
                            <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            </tr>"
;
                
?>
            <tr>
                <td><input type='text' name='nombre[]'></td>
                <td><input type='text' name='nombre[]'></td>
                <td><input type='text' name='nombre[]'></td>
            </tr>
        </table>
        <input type='submit' name='insertar' value='insertar'>
        </form>
    </body>
    </html>
¿Qué esperas que devuelva?