Q:

I have to insert data with the other table field USING PHP

Please Find below query for inserting the data but in h_id field, I have to insert another table field id all variable value I have to get from POST method 
INSERT INTO m_d_details(h_id, name, h_name, surname, village, resi,
mobile_no)VALUES('SELECT id from head_family ORDER BY id DESC LIMIT 1', 
'$mname', '$mhname', '$msurname', '$mvillage', '$maddress', '$mno')

A:

try :
INSERT INTO m_d_details 
            (h_id, 
             name, 
             h_name, 
             surname, 
             village, 
             resi, 
             mobile_no) 
SELECT id, 
       '$mname', 
       '$mhname', 
       '$msurname', 
       '$mvillage', 
       '$maddress', 
       '$mno' 
FROM   head_family 
ORDER  BY id DESC 
LIMIT  1 

