$_POST[url] = $url; if isset($url) { header( 'Location: ' . $url) } else [insert HTML here]