Jump to content

Recommended Posts

I have an IF like so:

if($info1[amount] < $input1 && $item1 != 0){
echo "You don't have enough of at least one of the items you wanted to give.";
}

 

and with the variables I've set it should echo it out but it doesn't.

 

$info1[amount] = 472

$input1 = 500

$item1 = dappp

Link to comment
https://forums.phpfreaks.com/topic/83075-solved-ifand-else-problems/
Share on other sites

I'll post the whole script:

if($count1 != 1 && $item1 != 0){
echo "You don't have enough of at least one of the items you wanted to give.";
}elseif($count2 != 1 && $item2 != 0){
echo "You don't have enough of at least one of the items you wanted to give.";
}elseif($count3 != 1 && $item3 != 0){
echo "You don't have enough of at least one of the items you wanted to give.";
}elseif($count4 != 1 && $item4 != 0){
echo "You don't have enough of at least one of the items you wanted to give.";
}elseif($count5 != 1 && $item5 != 0){
echo "You don't have enough of at least one of the items you wanted to give.";
}elseif(!$item1 && !$item2 && !$item3 && !$item4 && !$item5){
echo "You didn't select any items to donate!";
}elseif($info1['amount'] < $input1 && $item1 != 0){

// IT SHOULD STOP HERE
echo "You don't have enough of at least one of the items you wanted to give.";
}elseif($info2['amount']<$input2 && $item2!=0){
echo "You don't have enough of at least one of the items you wanted to give.";
}elseif($info3['amount']<$input3 && $item3!=0){
echo "You don't have enough of at least one of the items you wanted to give.";
}elseif($info4['amount']<$input4 && $item4!=0){
echo "You don't have enough of at least one of the items you wanted to give.";
}elseif($info5['amount']<$input5 && $item5!=0){
echo "You don't have enough of at least one of the items you wanted to give.";
}else{

if(count($no_zero) == count(array_unique($no_zero))){

// IT ENDS HERE


}else{
echo "You selected the same item more than once!";
}

}

 

I added tags to show what happens

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.