Hello, I am a vendor for clickbank setting up my affiliate links to allow affiliates to use different links to send them to three different pages (products). I am currently using the code below, but it only works for the last "If" statement (product 3) and the "else" statement (product 1), but not for product 2. Currently using these three clickbank links: AFFILIATE.VENDER.hop.clickbank.net/ and AFFILIATE.VENDER.hop.clickbank.net/?site2=product2 and AFFILIATE.VENDER.hop.clickbank.net/?site3=product3 code: <?php $site2 = $_GET['site2']; $site3 = $_GET['site3']; if($site2 == "product2") { $address = "www.example.com/product2/"; header("Location: $address"); } if($site3 == "product3") { $address = "www.example.com/product3/"; header("Location: $address"); } else { $address = "www.example.com/product1/"; header("Location: $address"); } ?> So, product 1 & 3 works, but NOT product 2. Can someone tell me if there is something I can fix here to make this work right?
Why don't make one variable? index.php?site=product1 index.php?site=product2 index.php?site=product3 $address = ""; $site = $_GET['site']; if ($site === "product2") { $address = "www.example.com/product2/"; header("Location: $address"); } elseif ($site === "product3") { $address = "www.example.com/product3/"; header("Location: $address"); } else { $address = "www.example.com/product1/"; header("Location: $address"); } Code (markup): and this case is suitable for switch statement.