<?php 
if(!isset($_POST['submit']))
{
	header("Location:/local-area-numbers/");
} else
{
	$fullname = trim($_POST['city']);
	$pos = strpos($fullname," ");
	if($pos == false)
		header("Location:/local-area-numbers/");
	else
	{
		$code = substr($fullname,1,$pos-1);
		
		if($code == '800' || $code == '844' || $code == '845' || $code == '870' || $code == '871')
		{
			$link = '/national-uk-numbers/0'.$code.'-phone-numbers.html';
			header("Location:".$link);
		} elseif ($code == '7-D' || $code == '7-K' || $code == '7-PN2') 
		{
			$link = '/personal-numbers-uk/0'.$code.'-phone-numbers.html';
			header("Location:".$link);
		} else
		{
			$fullcity = substr($fullname, $pos+1);		
			$city = strtolower(str_replace(".","",str_replace("- ","",str_replace(")","",str_replace("(","",str_replace(" ","-",$fullcity))))));
			$link = '/local-area-numbers/0'.$code.'-'.$city.'-uk-numbers.html';
			header("Location:".$link);
		}
	}
}

?>