Re: Beginners Problem
| From: | ioannes | Date: | Tue, 08 Jan 2008 15:06:11 +0000 |
| Subject: | Re: Beginners Problem | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-44493@lists.php.net to get a copy of this message | ||
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("SELECTusernameFROMusersWHEREusername= '$user' ANDpassword= '$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.