I am trying to insert my data from a form and from a database, that is to say that from my form I only add payroll and dates and when executing in the INSERT I insert what is related to that payroll number of the table used, I saw that it was done with a SELECT inside the INSERT but it does not work for me, I could be guided, what I'm doing wrong. I leave my code:
mysqli_query($con, "INSERT INTO
roles_turno_emp
(NOMBRE,NOMINA,RUTA,F_INICIAL,F_FINAL)
VALUES
(SELECT nombre FROM empleado WHERE nomina = '$_POST[nomina]',
'$_POST[nomina]',
SELECT ruta FROM empleado WHERE nomina = '$_POST[nomina]'),
'$_POST[fecha1]',
'$_POST[fecha2]'");