Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/05/2011, 08:44
Nexus10
 
Fecha de Ingreso: febrero-2010
Mensajes: 295
Antigüedad: 14 años, 3 meses
Puntos: 58
Respuesta: Problema con bucle while

Hola otobusmzn.

darkasecas tiene razón, la parte de html debe de ir fuera del php en la medida de lo posible. Ponerlo dentro no tiene sentido, además que te dificulta mucho el código. La cosa sería así:

Código PHP:
<?php 
include('config.php'); //Contiene los datos de la conexion a la BBDD 

//Este formulario enviara los datos a registrar.php, los comprobara, y si estan correctos, los introducira en la BBDD 

?>


   <form action="registrar.php" method="POST"> 
        Nombre: <input type="text" name="nombre" size="62" MAXLENGTH="30"><br> 
        Apellidos: <input type="text" name="apellidos" size="62" MAXLENGTH="50"><br> 
        Fecha de nacimiento:  
            Dia <SELECT NAME="dian" > 
            <OPTION SELECTED>1<OPTION>2<OPTION>3<OPTION>4<OPTION>5<OPTION>6<OPTION>7<OPTION>8<OPTION>9<OPTION>10<OPTION>11<OPTION>12<OPTION>13<OPTION>14<OPTION>15<OPTION>16<OPTION>17<OPTION>18<OPTION>19<OPTION>20<OPTION>21<OPTION>22<OPTION>23<OPTION>24<OPTION>25<OPTION>26<OPTION>27<OPTION>28<OPTION>29<OPTION>30<OPTION>31 
            </SELECT> 
            Mes <SELECT NAME="mesn" > 
            <OPTION SELECTED>1<OPTION>2<OPTION>3<OPTION>4<OPTION>5<OPTION>6<OPTION>7<OPTION>8<OPTION>9<OPTION>10<OPTION>11<OPTION>12 
            </SELECT> 
            Año <select name="ano"> 
            <option value="" selected>(Seleccionar)</option> 
            <?php
             
for ($anoactual=date('Y'); $anoactual>=1900$anoactual--){ 
               echo 
"<option value='$anoactual'>".$anoactual."</option>";
            
            }; 
            
?>
            </select> 
            <br> 
        Nombre de Usuario: <input type="text" name="nick" size="62" MAXLENGTH="15"><br> 
        Password: <input type="password" name="pass" size="62" MAXLENGTH="18"><br> 
        Repetir Password: <input type="password" name="pass1" size="62" MAXLENGTH="18"><br> 
        Email: <input type="text" name="email" size="62" MAXLENGTH="60"><br> 
        <input type="submit" name="submit" value="Enviar"> 
    </form>
El php lo pones solo donde sea necesario. Lo demás lo dejas como html.
Te he cambiado el bucle while por un bucle for, pero es lo mismo.
Para el día y el mes puedes hacer bucles parecidos. No es necesario que pongas lo que has puesto. Aunque ya lo tienes hecho déjalo, pero yo te recomendaría que lo intentaras hacer con bucles para practicar.

Un saludo.

EDITO: s00rk se me ha adelantado XD