ayaya Posted February 9, 2013 Share Posted February 9, 2013 can anyone tell me what's wrong with this code? if (isset($_POST['id']=='admin')) {... } why it displays "syntax error, expecting ',' or')' ? if i want to know if the id=admin, how should I do? Quote Link to comment https://forums.phpfreaks.com/topic/274274-how-to-use-isset/ Share on other sites More sharing options...
Jessica Posted February 9, 2013 Share Posted February 9, 2013 isset() just tells you if it exists and is set. You then compare the variable to the value you want to check as a separate evaluation. Quote Link to comment https://forums.phpfreaks.com/topic/274274-how-to-use-isset/#findComment-1411401 Share on other sites More sharing options...
denno020 Posted February 9, 2013 Share Posted February 9, 2013 (edited) So what you want to do is separate your if conditions if(isset($_POST['id']) && $_POST['id'] == "admin"){} Denno Edited February 9, 2013 by denno020 Quote Link to comment https://forums.phpfreaks.com/topic/274274-how-to-use-isset/#findComment-1411406 Share on other sites More sharing options...
ayaya Posted February 10, 2013 Author Share Posted February 10, 2013 Thank you very much!!! Quote Link to comment https://forums.phpfreaks.com/topic/274274-how-to-use-isset/#findComment-1411514 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.