Yes, it is possible. You have to do something like this:
if(isset($_POST['submit']))
{
$type_id = ($_POST['type_id'] == '' ? "null" : "'".$_POST['type_id']."'");
$sql = "INSERT INTO `table` (`type_id`) VALUES (".$type_id.")";
}
It checks if the $_POST['type_id']
variable has an empty value.
If yes, it assign NULL
as a string to it.
If not, it assign the value with ' to it for the SQL
notation