first, edit the set session value code so an array is created of the coupon session variables by changing the name of the session from:
$_SESSION['coupon']
to:
$_SESSION['coupon'][]
for example:
<?php
if (!session_id()) session_start();
if((((isset($_POST["coupon"]))?$_POST["coupon"]:"") != "")) {
$_SESSION["coupon"][] = "".((isset($_POST["coupon"]))?$_POST["coupon"]:"") ."";
}
?>
then create a discount rule for each possible coupon code. For the trigger, select "custom expression" and add the following code:
isset($_SESSION["coupon"]) && in_array("12345",$_SESSION["coupon"])
where "12345" is the coupon code.