echo '<a href="'. $site_url .'" onclick=" window.open('. $refferal_url .'); ">';
results
<a href="http://example.com/" onclick=" window.open(http://example.com/some-url/); ">
The problem is i can't get to put single quote before and after http://example.com/some-url/
because i always get the error.
How can i do this?
You have to escape the single quotes because they are in a single-quoted string. Add \'
where you want the single quotes.
Example:
echo '<a href="'. $site_url .'" onclick=" window.open(\''. $refferal_url .'\'); ">';
By the way, "referral" has two r
s, not two f
s.