assuming that your text box has the name "direct" and that your form is POSTing the data, then you could use this:
<?
if(!empty($_POST['direct']))
{
$location = $_POST['direct'];
header("Location:$location.htm");
}
else
header("Location:form.htm");
?>
bare in mind that headers must must must be sent before any html is sent to the page - ie before <html>, before a space character, before anything!