anevins Posted April 4, 2011 Share Posted April 4, 2011 This doesnt' work: if (!empty($b_house) && !empty($b_postcode) && !empty($b_city) && !empty($b_country) && !empty($d_house) && !empty($d_postcode) && !empty($d_city) && !empty($d_country)){ ... } replacing !empty with isset doesn't work either. I just want to say if all of them are not empty, do the if statement. Any solutions? Quote Link to comment https://forums.phpfreaks.com/topic/232631-form-validation-problems/ Share on other sites More sharing options...
exhaler Posted April 4, 2011 Share Posted April 4, 2011 can u post the values that you are passing to each one? Quote Link to comment https://forums.phpfreaks.com/topic/232631-form-validation-problems/#findComment-1196501 Share on other sites More sharing options...
JasonLewis Posted April 4, 2011 Share Posted April 4, 2011 Perhaps one of them is actually empty hm? Check your inputs and outputs, see if they are what you expect. It's the first step of debugging. Oh and just to be sure, empty deems the following to be classified as 'empty': "" (an empty string) 0 (0 as an integer) "0" (0 as a string) NULL FALSE array() (an empty array) var $var; (a variable declared, but without a value in a class) Quote Link to comment https://forums.phpfreaks.com/topic/232631-form-validation-problems/#findComment-1196503 Share on other sites More sharing options...
anevins Posted April 4, 2011 Author Share Posted April 4, 2011 var dump on all variables declared (8 variables) string(2) "44" string(7) "id8 8fd" string(9) "idontknow" string(6) "noidea" string(2) "19" string(7) "pb3 2dd" string(9) "idontknow" string(6) "noidea" Quote Link to comment https://forums.phpfreaks.com/topic/232631-form-validation-problems/#findComment-1196512 Share on other sites More sharing options...
JasonLewis Posted April 4, 2011 Share Posted April 4, 2011 So they are all empty strings, yet you want to run the if statement if all of them are NOT EMPTY. Is that right? From the code you've given, assuming all the variables mentioned are in fact not empty, the if statement should be triggered fine. However if one is empty then of course the statement will return false. Quote Link to comment https://forums.phpfreaks.com/topic/232631-form-validation-problems/#findComment-1196517 Share on other sites More sharing options...
anevins Posted April 4, 2011 Author Share Posted April 4, 2011 If I try and echo something out within that if statement, nothing is echod.. When I var dumped those variables, nothing was outputted to the browser when inside the if statement, but before it I got those values posted just above Quote Link to comment https://forums.phpfreaks.com/topic/232631-form-validation-problems/#findComment-1196523 Share on other sites More sharing options...
JasonLewis Posted April 4, 2011 Share Posted April 4, 2011 Well testing your script on my machine, setting the variables manually, produces the desired result. So your code is fine, something isn't right with your input/output.. :-\ Quote Link to comment https://forums.phpfreaks.com/topic/232631-form-validation-problems/#findComment-1196524 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.