Jump to content

[SOLVED] IFand ELSE problems


almightyegg

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.