Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/08/2007, 21:25
braiank
 
Fecha de Ingreso: diciembre-2005
Mensajes: 249
Antigüedad: 18 años, 4 meses
Puntos: 0
Problema con formulario

Hola.
Tengo un problema con mi formulario de registracion, cuando te equivocas en algo por ejemplo al volver al formulario te lo borra todo, yo quisiera que quede todo como estaba antes

Por ejemplo : http://www.atconcert.net/index.php?a...arse&tiporeg=u

el codigo es :

Código PHP:
   function formb() 
   { 
            $link=Conectarse();
?>

            <form method="POST">
             <br>

        <TABLE style="width: 100%; height: 35%" BORDER=0 CELLSPACING=1 CELLPADDING=1>

        <TR><td class='b' width='20%'>Usuario</TD> 
            <td class='c' width='80%'><input type="text" name="usuario" maxlength="20"></TD></TR>
        <TR><td class='b'>Contraseña</TD> 
            <td class='c'><input type="password" name="password" maxlength="10"></TD></TR>
        <TR><td class='b'>Contraseña (Verificación)</TD> 
            <td class='c'><input type="password" name="password2" maxlength="10"></TD></TR>
        <TR><td class='b'>E-Mail</TD>  
            <td class='c'><input type="text" name="email"></TD></TR>
        <TR><td class='b'>Genero</TD> 
            <td class='c'><select name="genero"><option value="m">Hombre</option><option value="w">Mujer</option></select></TD></TR>
        <TR><td class='b'>País</TD> 
            <td class='c'>
<select name='pais'>
<?
$get_paisesid
=mysql_query("SELECT * FROM paises ORDER BY country_name ASC");
while (
$row mysql_fetch_array($get_paisesid))
{
  echo 
"<option value='".$row['country_code']."'>".$row['country_name']."</option>";
}
?>
</select>
            </TD></TR>
        <TR><td class='b'>Ubicación</TD> 
            <td class='c'><input type="text" name="ubicacion" maxlength="60"></TD></TR>
        <TR><td class='b'>Sitio Web</TD> 
            <td class='c'><input type="text" name="sitioweb" maxlength="55"></TD></TR>
        <TR><td class='b'>Nombre Completo</TD> 
            <td class='c'><input type="text" name="nombre">
            </TD></TR>
        <TR><td class='b'>Avatar de usuario</TD> 
            <td class='c'><input type='text' name='avatar' maxlength='100'> Colocar vínculo web donde este ubicado el avatar (Tamaño 100x100)</TD></TR>
     </table>
          <br><b>NOTA:</b> Al registrarte, tambien te estaras registrando al foro de AtConcert.net.
            <br><br><center><input type="submit" value="OK">
              </form>
         </center>

<?  
    
}

    if (!
$_POST
    {
              
formb();
    }
    else 
    {
              
$usuario $_POST['usuario'];
              
$password2 $_POST['password'];
              
$passwordmd md5($_POST['password2']);
              
$email $_POST['email'];
              
$date=date("Y-m-d");                 
              
$clonmail mysql_fetch_array(mysql_query("SELECT COUNT(*) AS count from usuarios where user_email='".$email."'"));
              
$clonuser mysql_fetch_array(mysql_query("SELECT COUNT(*) AS count from usuarios where user_name='".$usuario."'"));

              
$ip=getenv("REMOTE_ADDR");


              if (
$password != $password2
              {
                    echo 
'<script language="javascript">
                        alert("Las passwords no coinciden.");
                        location.href=("index.php?a=registrarse&tiporeg=u");
                        </script>'

              }
              elseif (
$usuario == '' || $email == '' || $password == '' || $password2 == '')
              {
                    echo 
'<script language="javascript">
                        alert("Llena todos los datos.");
                        location.href=("index.php?a=registrarse&tiporeg=u");
                        </script>'

              }
              elseif (!
ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$"$email))
              {
                    echo 
'<script language="javascript">
                        alert("Ingresa un E-Mail valido.");
                        location.href=("index.php?a=registrarse&tiporeg=u");
                        </script>'

              }

              elseif (
$clonmail['count'] != || $clonuser['count'] != 
              {
                    echo 
'<script language="javascript">
                        alert("El e-mail o usuario ingresado ya existe en la base de datos, ingresa otro por favor.");
                        location.href=("index.php?a=registrarse&tiporeg=u");
                        </script>'

              }
              else
              {
                        [
B]CODIGO DE PROCESO[/B]
              }