xbl1 Posted April 11, 2008 Share Posted April 11, 2008 Hi;i am trying to write a register form for user.i got a problem that the sign up of submit bottom doesn't sit properly after fill some invalid input and click the sign up bottom. but before fill anything to form, everything sit ok, no problem at all. And this problem happens in the IE browser, not in the Firefox browser.Could anyone help me find out the problem, please.please go to the link.http://writeanything.org/Register.phpvalid password1) at least 8 char2) at one lower char3) at least one upper char4) at least one digitplease fill some invalid input to see the different before and after that.my code as following:Register.php <?php session_start();?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"><html lang="en"> <head><title> Welcome to login </title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><head><style type="text/css">body{ padding: 0px; margin: 0px; border: 0px; background-color: white;}#container{ padding: 0px; border-top: 2px solid #1d2add; border-bottom: 2px solid #1d2add; border-left: 1px solid #3b44b5; border-right: 1px solid #3b44b5; margin-left: auto; margin-right: auto; margin-top: 5%; margin-bottom: auto; width: 330px; height: 370px;}#t1{ font-weight: bold; font-size: 18px; color: white; background-color:#3542eb;}form{ padding:0px; border: 0px; margin: auto; width: 280px;}#JoinMe{ background-color: #41ac1c; padding: 2px; border: 2px solid #94e07a; color: white; font-size: 12px; font-weight: bold;}#JoinMe:hover{ background-color: #237516; border: 2px solid #104108; padding: 2px;}table{ padding: 0; border: 0; margin: 0;}tr{ padding: 0; border: 0; margin: 0;}td{ padding: 0; border: 0; margin: 0;}.errorM{ padding:0; margin:0; font-weight: bold; font-size: 12px; color: red; background-color:white;}</style></head><body> <div id="container"> <form action="/RegisterP2.php" method="post"> <table> <tr><td colspan="2" id="t1">Welcome to join xxxx</td></tr> <?php if($_SESSION['register_flag']==0) echo ("<tr><td colspan=\"2\" class=\"errorM\">some invalid field below, please reenter again.</td></tr>"); ?> <tr><td> Email Address:</td><td><input type="text" name="email" maxlength="60" value="<?php if($_SESSION['register_flag']==0) echo $_SESSION['register_email']; ?>"><?php if($_SESSION['register_errorM_Email']!="") { echo "<span class=\"errorM\">"; echo $_SESSION['register_errorM_Email']; echo "</span>"; } ?></td></tr> <tr><td>Password:</td><td><input type="password" name="pass1" maxlength="30"><?php if($_SESSION['register_errorM_Password']!="") { echo "<span class=\"errorM\">"; echo $_SESSION['register_errorM_Password']; echo "</span>"; } ?></td></tr> <tr><td>Confirm Password:</td><td><input type="password" name="pass2" maxlength="30"><?php if($_SESSION['register_errorM_Password']!="") { echo "<span class=\"errorM\">"; echo $_SESSION['register_errorM_Password']; echo "</span>"; } ?></td></tr> <tr><td colspan="2"><hr></td></tr> <tr><td> Display Name:</td><td><input type="text" name="DisplayName" maxlength="30"></td></tr> <tr><td> First Name:</td><td><input type="text" name="FirstName" maxlength="30"></td></tr> <tr><td>Last Name:</td><td><input type="text" name="LastName" maxlength="30"></td></tr> <tr><td>Country:</td><td><input type="text" name="Country" maxlength="30"></td></tr> <tr><td>State or City:</td><td><input type="text" name="StateCity" maxlength="30"></td></tr> <tr><td colspan="2"><hr></td></tr> <tr><td>Age</td><td><input type="text" name="age" maxlength="30"></td></tr> <tr><td>Gender:</td><td><input type="radio" checked="checked"name="######" value="male">Male <input type="radio" checked="checked"name="######" value="female">Female </td></tr><tr><td colspan="2" align="right"> <input type="submit" name="Join" value="Sign Up" id="JoinMe"></td></tr> </table></form></container></body></html> /////////////////RegisterP2.php <?php session_start(); //error massage for validate form $_SESSION['register_errorM_Email']=""; $_SESSION['register_errorM_Password']=""; //flag to check user input, 1=valid, 0=invalid $_SESSION['register_flag']=1; if(isset($_POST['Join'])){ $email_pattern = '#.*@.*\..*#'; $_SESSION['register_email'] = $_POST['email']; //email pass validation; if (preg_match($email_pattern, $_POST['email']) > 0) { } else{ //not validate $_SESSION['register_errorM_Email']="**"; $_SESSION['register_email'] =""; $_SESSION['register_flag']=0; } $password1 = $_POST['pass1']; $password2 = $_POST['pass2']; //valid if ($password2==$password1) { } else { $_SESSION['register_errorM_Password']="**"; $_SESSION['register_flag']=0; } //valid if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password1)) { } else { $_SESSION['register_errorM_Password']="**"; $_SESSION['register_flag']=0; } //valid if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password2)) { } else { $_SESSION['register_errorM_Password']="**"; $_SESSION['register_flag']=0; } if( $_SESSION['register_flag']==1) header('Location:RegisterP3.php'); else header('Location:Register.php'); }?> Link to comment Share on other sites More sharing options...
jlhaslip Posted April 11, 2008 Share Posted April 11, 2008 #container{ padding: 0px; border-top: 2px solid #1d2add; border-bottom: 2px solid #1d2add; border-left: 1px solid #3b44b5; border-right: 1px solid #3b44b5; margin-left: auto; margin-right: auto; margin-top: 5%; margin-bottom: auto; width: 330px; height: auto ;} Link to comment Share on other sites More sharing options...
xbl1 Posted April 11, 2008 Author Share Posted April 11, 2008 Thanks. it works perfect now.But do you known another solution to fix this problem, like set the tag element's padding, bordering or margin to some value? Link to comment Share on other sites More sharing options...
jlhaslip Posted April 11, 2008 Share Posted April 11, 2008 the problem is that with a fixed height for the div, and then changing the content by adding the error line, it does not adapt to the new height, so use auto for the height adapts to the content. Link to comment Share on other sites More sharing options...
xbl1 Posted April 11, 2008 Author Share Posted April 11, 2008 the problem is that with a fixed height for the div, and then changing the content by adding the error line, it does not adapt to the new height, so use auto for the height adapts to the content.yes, you are right. thanks a lot. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.