Use this query.
if(isset($_POST['txtSpace'])) {
$choice_spc_port = $_POST['txtSpace'];
}
if(isset($_POST['txtLocation'])) {
$choice_loc = $_POST['txtLocation'];
}
$insert = mysql_query("INSERT INTO dbForm (db_space_portion, db_animal_location) VALUES ('{$choice_spc_port}', '{$choice_loc}')");
solved Undefined Index in php (I’ve searched all over internet, and stackoverflow, tried almost everything) [duplicate]