Php form for inserting records in mysql table

For inserting records with php in mysql table, we need html form, at least one table in mysql. So according to our need, make table with name employees which has three fields id,first_name and lastname as:
Create Table employees (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
first_name varchar(50), 
last_name varchar(50) default NULL,
gender varchar(10) default NULL,
)


After making table,now make php page insert_records.php with coding for inserting record in mysql and Html form as given below:

<?php
$msg="";
if(isset($_POST['btn'])){
$firstName=isset($_POST['first_name'])?$_POST['first_name']:"";
$lastName=isset($_POST['last_name'])?$_POST['last_name']:"";
$gender=isset($_POST['gender'])?$_POST['gender']:"";
if(!empty($firstName)){
$host="localhost";
$user="mysql_user_name";
$pass="mysql_password";
$db="database_name";
$link=mysql_connect($host,$user,$pass) or die("Could not connect database".mysql_error());
if($link)
{
mysql_select_db($db,$link) or die("could not select database".mysql_error());
$query="INSERT INTO employees (first_name,last_name,gender)";
$query.="VALUES('".mysql_escape_string($firstName)."'
,'".mysql_escape_string($lastName)."
,'".mysql_escape_string($gender)."');";
$result=mysql_query($query);
if($result){
$msg="Record successfully inserted!!!";
}
else
{
$msg="Sorry, there was problem while inserting the record!!!";
}
mysql_close($link);
}
} 
else
{
$msg="First name cannot be blank!!!";
}
echo $msg; //for getting messages
}
?>

<form name="form1" id="form1" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post"> <table> <tr> <td> First Name </td> <td> <input type="text" name="first_name" id="first_name" maxlength="45"> </td> </tr> <tr> <td> Last Name </td> <td> <input type="text" name="last_name" id="last_name" maxlength="45"> </td> </tr> <tr> <td> Gender </td> <td> <input type="radio" name="gender" id="gender-1" value="Male"> Male <input type="radio" name="gender" id="gender-2" value="Female"> Female </td> </tr> <tr> <td> </td> <td> <input type="submit" name="btn" id="btn" value="Save" > </td> </tr> </table> </form>