Just need a little help here for a personal-learning project. I've searched numerous similar posts with no luck.
The goal is to shorten my code by using an array within the following else-if statement (rather than having 40+ else-if's re-iterating the same thing).
The following code is working if I spell out each else-if statement, I'm simply looking to improve it.
<?php
$affiliate1 = array('productA', 'productB', 'productC', 'productD', 'ProductE', 'productF');
?>
<?php
$affiliate2 = array('productG', 'productH', 'productI', 'productJ', 'ProductK', 'productL');
?>
<?php $returnaddress = $_POST['product_name']; ?>
<?php if ($returnaddress == "$affiliate1") $returnaddress = 'Address1';
elseif ($returnaddress == "$affiliate2") $returnaddress = 'Address2';
?>
<?php echo $returnaddress;?>
Any help/explanation is greatly appreciated! I've searched for a few hours but haven't been able to find examples specific enough to my case.