jdock1 Posted June 28, 2009 Share Posted June 28, 2009 Im using an if statement if ($user =="") { echo "<div class='error'>Wrong username or password combination! You entered $user, $passwd.</div>"; } But of course its echoing before the variables are passed. How do I define it as empty beforehand? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/163956-how-do-i-define-this/ Share on other sites More sharing options...
n1tr0b Posted June 28, 2009 Share Posted June 28, 2009 try this if($user == null) { echo 'NO USER DEFINED!!'; } Quote Link to comment https://forums.phpfreaks.com/topic/163956-how-do-i-define-this/#findComment-864953 Share on other sites More sharing options...
RichardRotterdam Posted June 28, 2009 Share Posted June 28, 2009 But of course its echoing before the variables are passed. How do I define it as empty beforehand? Thanks! Could you eleborate that? are you using a form if ($user =="") { echo "<div class='error'>Wrong username or password combination! You entered $user, $passwd.</div>"; } Hope this is for testing purposes echoing out passwords is not such a good idea Quote Link to comment https://forums.phpfreaks.com/topic/163956-how-do-i-define-this/#findComment-864956 Share on other sites More sharing options...
jdock1 Posted June 28, 2009 Author Share Posted June 28, 2009 try this if($user == null) { echo 'NO USER DEFINED!!'; } Thanks, but that didnt seem too work =/ Quote Link to comment https://forums.phpfreaks.com/topic/163956-how-do-i-define-this/#findComment-864957 Share on other sites More sharing options...
Ken2k7 Posted June 28, 2009 Share Posted June 28, 2009 Before the if statement, just put: $user = $passwd = ''; Quote Link to comment https://forums.phpfreaks.com/topic/163956-how-do-i-define-this/#findComment-864960 Share on other sites More sharing options...
n1tr0b Posted June 28, 2009 Share Posted June 28, 2009 try this if($user == null) { echo 'NO USER DEFINED!!'; } Thanks, but that didnt seem too work =/ there is a reason why it didn't work $user = $_POST['usernmae']; //define this first if($user == null) { echo 'NO USER DEFINED!!'; } Quote Link to comment https://forums.phpfreaks.com/topic/163956-how-do-i-define-this/#findComment-864967 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.