perezf Posted September 10, 2006 Share Posted September 10, 2006 :-\what is wrong with the following codei am getting an error[quote]Parse error: parse error, unexpected T_BOOLEAN_AND in /hsphere/local/home/way2fr3s/2fr3sh.com/userlogin.php on line 15[/quote][code]<?php $username = "admin";$password = "password";$user = $_POST['user'];$pass = $_POST['pass'];if($user == $username) && if($pass == $password) {//line 15echo "Welcome to our site $user.";} else { ?><form name="form1" method="post" action=""> <p> UserName:<br> <input type="text" name="user"> <br> Password:<br> <input type="text" name="pass"> <br> <input type="submit" name="Submit" value="Submit"></p></form><?php } ?>[/code] Link to comment https://forums.phpfreaks.com/topic/20286-help-with-simple-php/ Share on other sites More sharing options...
tomfmason Posted September 10, 2006 Share Posted September 10, 2006 try this[code=php:0]if ($user == $username && $pass == $password) {[/code]Hope this helps,Tom Link to comment https://forums.phpfreaks.com/topic/20286-help-with-simple-php/#findComment-89310 Share on other sites More sharing options...
ahmed17 Posted September 10, 2006 Share Posted September 10, 2006 if($user == $username) && if($pass == $password) using $$ for not tie two if statment by using for tie its contents if ($user == $username && $pass == $password) Link to comment https://forums.phpfreaks.com/topic/20286-help-with-simple-php/#findComment-89315 Share on other sites More sharing options...
perezf Posted September 10, 2006 Author Share Posted September 10, 2006 it works thank you to all Link to comment https://forums.phpfreaks.com/topic/20286-help-with-simple-php/#findComment-89321 Share on other sites More sharing options...
perezf Posted September 10, 2006 Author Share Posted September 10, 2006 i could i read the username and password from a database Link to comment https://forums.phpfreaks.com/topic/20286-help-with-simple-php/#findComment-89322 Share on other sites More sharing options...
perezf Posted September 10, 2006 Author Share Posted September 10, 2006 how could i i meant to say Link to comment https://forums.phpfreaks.com/topic/20286-help-with-simple-php/#findComment-89325 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.