I use: if(ISSET($select_sql_two)&&$select_sql_two<>""&&!is_null($select_sql_two)) { or if($select_sql_two=="submit") { if "submit" is the button value. I am not sure which is best. John Ben Stones wrote:
Hello, I am having another problem with PHP, and I have tried rectifying the problem with each try failing. The problem I have is, whenever I refresh the page or visit the URL to where the login form is (which is index.php), it automatically refreshes to the members page, even if I did not click the 'Submit' button (with or without the correct login details, for that matter, even if I did click the 'Submit' button). I hope someone will be able to help me in some way or another to rectify the issue; I have tried seeing all possibilities of the problem. Once more, I am relatively knew to PHP, so I appreciate help towards the right direction. Cheers, Ben Stones. (PS: The PHP code is below) $con = mysql_connect("localhost", "ben_test", "removed") or die(mysql_error()); $db = mysql_select_db("ben_test") or die(mysql_error()); $user = $_POST['username']; $pass = $_POST['password']; $select_sql = sprintf("SELECT `username` FROM `users` WHERE `username` = '$user' AND `password` = '$pass'", mysql_real_escape_string($user), mysql_real_escape_string($pass)); $select_sql_two = mysql_query($select_sql); if($select_sql_two) { echo 'Redirecting you to members page...'; echo '[meta http-equiv="refresh" content="5;url=members.php" /]'; } else { echo 'Error'; } I've changed the HTML code, by the way, so it doesn't render the HTML code in some mail boxes.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php