Your assignments are backwards. You want to read the cookie, not set the cookie. Also, you don't use .
if you're interpolating a variable inside a string, only when you're concatenating strings.
for($x=1; isset($_COOKIE["link$x"]); $x++){
$link = $_COOKIE["link$x"];
$image = $_COOKIE["image$x"];
echo '<a href="'.$link.'"><img src="'.$image.'"></a>';
}