bindiya Posted December 20, 2010 Share Posted December 20, 2010 I have a login modal window which is user for entering the login and password, and check it with the database.If the login and password is not there i nthe database the message shuld be displayed in the popup window itself. But in my case the popup window disapperas if the login details are wrong. how shuld i code for this. My code is pasted below. <div id="cover"></div> <div id="dialog"> <form action='' method='post' name='onlinepay'> <table width="388" border=1><tr><td colspan="4" align="right"></td><td align="right"><a href="index.php" onclick="closePopUp('dialog');"><img src='images/close.jpg' align="right" /></a></td></tr> <tr><td width="11" ></td> <td width="90">Username </td> <td width="57">:</td> <td width="147"><input type='text' name='username' id='username' /></td><td width="59"></td> </tr> <tr><td></td><td>Password</td><td>:</td><td><input type='text' name='password' id='password' /></td><td><input type='submit' name='submit' id='submit' value="Login" /></td></tr><tr><td colspan='5'><?php //connection statements goes here if(isset($_POST['submit'])){ $username=$_POST['username']; $password=$_POST['password']; $sql="select username,password from register where username='$username' and password='$password'"; $result=mysql_query($sql); $row=mysql_fetch_row($result); $row1=mysql_num_rows($result); if(($row['0']==$username) && ($row['1']==$password)){ header ('Location:themes/index.php'); } else{ echo "Username and password doesnot match"; } } ?> </td></tr> <tr><td colspan="5"><hr color="#999999" /></td></tr><tr><td></td><td colspan='2'><a href="javascript:void window.open('themes/forgotpassword.php?fullview=Y','','height=350,width=525,resizable=yes,scrollbars=yes')">Forgot password? </a> </td> <td><a href='register.php'>New User</a></td> <td align='center'> </td> </tr> </table> </form> Quote Link to comment https://forums.phpfreaks.com/topic/222185-how-to-display-message-in-the-popup-window/ Share on other sites More sharing options...
Adam Posted December 20, 2010 Share Posted December 20, 2010 Shouldn't the form submit via an AJAX post when called from the modal window? Quote Link to comment https://forums.phpfreaks.com/topic/222185-how-to-display-message-in-the-popup-window/#findComment-1149451 Share on other sites More sharing options...
bindiya Posted December 20, 2010 Author Share Posted December 20, 2010 but my php code is in the same page and when i alert the error message through javascript it works.But the echo error mesg doesnot work Quote Link to comment https://forums.phpfreaks.com/topic/222185-how-to-display-message-in-the-popup-window/#findComment-1149453 Share on other sites More sharing options...
bindiya Posted December 20, 2010 Author Share Posted December 20, 2010 error printing like "username and login doesnot match ' in my popup window is the one i need, after login check Quote Link to comment https://forums.phpfreaks.com/topic/222185-how-to-display-message-in-the-popup-window/#findComment-1149455 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.