Step 1 is getting it working which the others above are doing a good job trying to help you with but Step 2 is probably more important and making sure it's secure.

What your doing is letting people enter a url but your not doing any security checks to see if it's a real url or a hacking attempt with malicious code.
Easiest ways of adding security are with strip_tags by finding
PHP Code: 
$url$_POST["link"]; 
Replace with:
PHP Code: 
$urlstrip_tags($_POST["link"]); 
or you can use htmlentities
and find
PHP Code: 
$url$_POST["link"]; 
Replace with:
PHP Code: 
$urlhtmlentities($_POST["link"]); 
or even both and have
PHP Code: 
$urlhtmlentities(strip_tags ($_POST["link"])); 
Their are other more complicated ways and you can use regex checks to make sure it's a url etc but as your just starting these are probably the easiest to understand.