添加外键和电话号码后数据库错误未加入数据库

This is my code for Registration Form

I just linked up the database usernames to images_tbl via foreign key. Now the problem is that I used images_id as the F-Key and now the data is not able to feed into the database, causing error for Failure. And if I add a variable as shown below

</head>

<body>
<form name="form1" method="post" action="register.php">
<table align="center" border="1" width="40%">
<tr>
<td>Enter your First Name: </td><td><input type="text" name="fname"></td>
</tr>
<td>Enter your Last Name: </td><td><input type="text" name="lname"></td>
</tr>
<td>Enter your Username: </td><td><input type="text" name="username"></td>
</tr>
<td>Enter your Password: </td><td><input type="password" name="password">    </td>
</tr>
<td>Adtitle: </td><td><input type="text" name="adtitle"></td>
</tr>
<td>Description: </td><td><input type="text" name="description"></td>
</tr>
<td>Email ID: </td><td><input type="text" name="emailid"></td>
</tr>


<?php
error_reporting(E_ALL ^ E_DEPRECATED);
if (isset($_POST["submit"])){
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$username = $_POST['username'];
$password = $_POST['password'];
$adtitle = $_POST['adtitle'];
$description = $_POST['description'];
$emailid = $_POST['emailid'];

here as

$images_id = $_POST['images_id'];

then it shows an undefined variable. And same for the Phone Number. Its showing Failure in connecting with the database. If any new column is added to the database.

$con = mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('chatbox') or die("cannot select DB");

$query=mysql_query("SELECT * FROM usernames WHERE username='".$username."' AND password='".$password."'");
$numrows=mysql_num_rows($query);
if($numrows==0) /*user doesn't belong to the db*/
{
$sql="INSERT INTO usernames(fname,lname,username,password,adtitle,description,emailid) VALUES ('$fname','$lname','$username','$password','$adtitle','$description','$emailid')";

$result=mysql_query($sql);

if($result)
{
echo "Account Successfully Created";
echo "Login <a href='index.php'> here </a><br>";
}
else
{
echo "Failure!";
}
}
else {
echo "That username already exists! Please try again with another.";
}   
}


?>


<tr>
<td colspan="2"><input type="submit" name="submit" value="Register"></td>
</tr>
<td>
<iframe src="saveimage.php" height="300px" />
</td>
</table>
</form>
</body>

</html>