I switched from sending stored codes to sending generated codes, but I found out that when an order with multiple items is placed my handler sends double the codes.
That is because the order data is POSTed multiple times, once for each item. So the simple for command I set up runs each time. for($i=1;$i<=$POST['numcart_items'];$i++){} This works perfectly, if the order data is only sent once. At the same time, each request for codes is full order data. So the request for item_name2 also has data for item_name1.
My problem is that I really need either the data to only be sent once, or the data to be item specific and not cart. Other than that, I really cannot come up with any other way to fix this issue.
I also tried including a query to check if the item was already delivered, and not run a script if so. The result was a lack of response for item2. Actually, that is a fairly consistent issue, with or without the additional query. Anyways, any advice or help would be appreciated.