Reputation: 35
<?php
$data=SOME_STRING;
$url="http://SOME_WEBSITE.com/".$data; //$url is a valid website with the addition of data
?>
<input type="button" value="button" onClick="window.open(<?php echo $url;?>)" >
But nothing happens when I click on the button.
It does work when I replace the PHP echo
with the precise url string but I want to be able to pass different urls.
Upvotes: 0
Views: 2305
Reputation: 160973
You need quotes:
<input type="button" value="button" onClick="window.open('<?php echo $url;?>')" />
Upvotes: 4