I’m kinda new to PHP and only really worked with it in flash based projects. I am having a problem and have searched everywhere, its at this stage driving me slowly insane, so I come to you all for help
Project backgroud: ok what I have is a basic content management system login, update delete add which is all working perfectly. i have a view page where the end user can select multiple checkboxes under different sections which is then forwarded to a confirm order page … depending on the checkboxes ticked and how many in each category a different response is supposed to be envoked using if else statement but I only get the first reply back no matter which boxes are checked.
I think there’s some problem in logic. You are ‘expecting’ different results, but remember that in the case that the IF condition is successful ($_POST[‘filling’] >= 3), the code in that IF will be executed and the following else’s and elseif’s (associated with that IF) will be ignored … their conditions won’t even be checked!
In essence, the checking will only progress to the next conditional statement (within that block of IF), if the previous condition is not satisfied (false, that is). Once a condition is rendered true, it will execute the code within that condition, and then move to the next block of code (out of the IF-ELSEIF-ELSE block).
thanks a mil for your help im really greatful and i get what you mean but even when i set everything to = instead of >= so i could take out that factor it is still only giving me the one result for every condition i only get the first result
if ($_POST['filling'] = 3){
echo "you ordered a 3 salad filling sandwich ";
}
elseif ($_POST['filling'] = 2 and $_POST['meat'] = 1){
echo "you ordered a 2 salad filling 1 meat sandwich ";
}
elseif ($_POST['meat'] = 2){
echo "you ordered a 2 meat sandwich ";
}
any more suggestions im going a bit insane i have been looking at this one piece of code for way too long and i think im starting to have nightmares about it