Incremental $_POST var names

I’m building the PayPal IPN script but the POST variables PayPal sends have number suffixes for the cart items, eg.

$_POST['option_selection1_1']
$_POST['option_selection1_2']
$_POST['option_selection1_3']

I would normally (in PHP) do a WHILE loop like this:

	$loopy = 0;
	do { // $loopy < $_POST['num_cart_items']
		$loopy++;
	// CODE HERE
	} while ($loopy < $_POST['num_cart_items']);

and then refer to the variables like this:

$_POST['option_selection1_' . $loopy]

How can I achieve this within an API script?

I’m using Set Value to start at zero, then do a WHILE var1 < $_POST['num_cart_items']

but how can I then reference the POST variables appending var1 to the variable name.

I hope I’ve explained this clearly enough.

Community Page
Last updated: