Quantity Conditional

Here's one that's got me stumped. Working in PHP5.I am building a store application for a client that makes use of a web service from a larger agency as he is a broker. This web service requires that items for purchase by end users be of a certain quantity or else the order will be considered ineligible for purchase.I must make dropdown option boxes that contain only eligible quantity numbers. Their rules are as follows:If a quantity greater than 12 is available, then allow any quantity EXCEPT that which would leave only one item remainingIf a quantity of less than 12 is available and said quantity is even, then allow only even pairs for purchaseIf a quantity of of less than 12 is available and said quantity is odd, then allow any quantity except that which would leave only one item remaining.I'm a bit confused as to how my conditionals to determine dropdown content should be structured to accommodate this. How could I know in advance, via conditionals, whether the final quantity vs the user's requested quantity would leave just one for purchase and thereby deny it?I can't imagine why the service issuer did not make it so an array of eligible quantities was returned rather than a hard number. Please also note there are two other rules that I've already manage to mete out.Any help would be greatly appreciated!
 
Back
Top