I need to check if multiple items are set and not empty in PHP

sgirllezbix

New Member
Below is a snippet of PHP that I need to get working, I need to make sure that 3 items are not set already and not === '' I have the part to make it check if not set but when I try to see if the values are empty as well (I might not even be thinking clearly right now, I might not need to do all this) But I need to make sure that redirect, login_name, and password are all not already set to a value, if they are set to a value I need to make sure that the value is not empty.Can someone help, when I add in check to see if values are empty, I get errors with my syntax, also not sure if I should have 5-6 checks like this in 1 if/else block like that, please helpI need to check the following:
- $_GET['redirect'] is not set
- $_REQUEST['login_name'] is not set
- $_REQUEST['login_name'] is not != to ''
- $_REQUEST['password'] is not set
- $_REQUEST['password'] is not != to '' \[code\]if (!isset($_GET['redirect']) && (!isset($_REQUEST['login_name'])) && (!isset($_REQUEST['password']))){ //do stuff}\[/code\]UPDATE Sorry It is not very clear, I was a bit confused about this. Based on Hobodaves answer, I was able to modify it and get it working how I need it. Below is the code how I need it, it works great like this... So if that can be improved then that is the functionality that I need, I just tested this. \[code\]if (!isset($_GET['redirect']) && empty($_GET['redirect']) && isset($_REQUEST['login_name']) && !empty($_REQUEST['login_name']) && isset($_REQUEST['password']) && !empty($_REQUEST['password'])) { echo 'load user';}\[/code\]if this was loaded then it will run the login process \[code\]login.php?login_name=test&password=testing\[/code\]If this is loaded then it will NOT run the login process \[code\]login.php?login_name=test&password= \[/code\]
 
Back
Top