Home > General > Affiliate Marketing Forum

PHP Help? (5)


10-04-2011 12:21 PM #1 shanktank (Member)
PHP Help?

I'm trying to do this dynamic variable thing based on the targets, but it keeps echo-ing the 1st variable only regardless of the target's value (ie domaina, DomainA).

Here's my code:
[PHP]<?php
$dyn1 = $_GET['target'];
if ($dyn1 == "domaina.com"||".domaina.com"||"domaina.co")
{$dyn2 = 'domaina';
$dyn3 = 'DomainA';
}
elseif ($dyn1 == "domainb.com"||".domainb.com"||"domainb.co")
{$dyn2 = 'domainb';
$dyn3 = 'DomainB';
}
elseif ($dyn1 == "domainc.com"||".domainc.com"||"domainc.co")
{$dyn2 = 'domainc';
$dyn3 = 'DomainC';
}
else {$dyn2 = 'notargets';
$dyn3 = 'NoTargets';
}
?>[/PHP]

What did I type wrongly?

On the same note, is there any way I can echo a target that has multiple variations like above (domainc.com, .domainc.com, domainc.co and many more) without manually adding the other variations into the above code?


10-04-2011 12:39 PM #2 bbrock32 (Administrator)

Yeah , just do it like that :

[PHP]
if(stristr($dyn1, 'domaina') !== FALSE) {
$dyn2="Domaina";
}

[/PHP]

replace domaina with the shortest string contained in the target you want ( for example walmart will do for walmart.com walmart.com .walmart etc )


10-04-2011 04:37 PM #3 hd2010 (Member)

not to bashing you, your php code is all wrong, the logic is totally out as well as the syntax.


10-05-2011 12:51 PM #4 stevenbell (Member)

How to use "PHP Code" in html? Thank you!


10-05-2011 02:45 PM #5 seank (Member)

Quote Originally Posted by stevenbell View Post
How to use "PHP Code" in html? Thank you!
http://www.besthostratings.com/artic...tml-files.html


Home > General > Affiliate Marketing Forum