PHP Code not working. And hell I just don't know why!?

Hey People,

I was working on my site when I came across some code that should have been easy for me to do, as it’s repeated like twice in the whole thing.

I just don’t know why it doesn’t work.

<?php
//Including configuration file which will contain the username, the password, the host and the database name.
include '../connect.php';
include '../functions.php';
//Declaring all the variables ready for posting
$title = $_POST['title'];
$oldlink = $_POST['link'];
$link = urlcheck($oldlink);
$desc = $_POST['desc'];
$sort = $_POST['sort'];
$type = $_POST['type'];
//Checking if the form is being posted
If (isset($_POST['submit'])){
	mysql_connect($host,$user,$pass);
	mysql_select_db($db);
	$query = "INSERT INTO sidelinks SET link = '" . $link . "',
		        			 title = '" . $title . "',
		        			 desc = '" . $desc . "',
		        			 sort = '" . $sort . "',
		        			 type = '" . $type . "'";
	mysql_query($query);
}
?>
<p class="menu_subtitles">Add an Item </p>
<form action="<?=$PHP_SELF?>" method="post" name="item" class="menu_item" id="item">
Item Title*:<br>
<input class="tbs" name="title" type="text" id="title">
<br>
Item Link*:<br>
<input class="tbs" name="link" type="text" id="link">
<br>
Item Type*:<br>
<input class="tbs" name="type" type="text" id="type" value="1" disabled>
<br>
Item Description*:<br>
<input class="tbs" name="desc" type="text" id="desc">
<br>
Item Sort*:<br>
<input class="tbs" name="sort" type="text" id="sort">
<br>
*Denotes a required field<br>
<input class="submitorclear" name="submit" type="submit" id="submit" value="Add Item">
<input class="submitorclear" type="reset" name="Reset" value="Clear">
</form>

Also, when someone/if someone solves this, I’ll post some more code like this that’s also annoying me.

Thanks anyway.
Benji