Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/232631-form-validation-problems/
Share on other sites

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)

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.