Apologies if this is a simple question and/or it's nonsensical.
What I'm trying to do is change the output of a string, based on 2 simple variables.
This is the original variable;
$src = 'http://example.org';
And I have the following option variables which pull data from a Wordpress shortcode (If it exists);
$bg = $attr['background'];
$col = $attr['color'];
What I want to achieve is this, if neither of the option variables have values the original variable remains unchanged.
If only one of the option variables exist, the original variable's value becomes;
http://example.org?background='.$bg.'
or
http://example.org?color='.$col.'
Depending on which one has a value.
If both option variables have values, the original value needs to become;
http://example.org?background='.$bg.'&color='.$col.'
Can someone point me in the right direction on this please? It would be greatly appreciated.