Hi, I have the following problem with a query, I have a form that I upload to my bd but the user has the option not to fill in all the fields, the problem is that in my table the fields that are varchar are uploaded as undefined when the user uploads an empty field.
This complicates me when I call those fields for the user to edit because they appear as undefined instead of empty.
How can I solve this? (I use ajax to send the data to the php where the query is and they are received with the post method)
Query:
$query = "INSERT INTO postulante_26 ( pos_rut, pos_nombre, pos_curso_id ,apo_rut, apo_nombre, apo_parentesco_id, telefono, celular, email, direccion, comuna, fecha, ano_postulacion, fun_rut, fun_nombre, her_rut, her_nombre, egr_rut, egr_nombre, motivo, motivo_otro) VALUES ('$pos_rut', '$pos_nombre', '$pos_curso', '$apo_rut', '$apo_nombre', '$apo_paren', '$telefono', '$celular', '$email', '$direccion', '$comuna', '$fecha', '$ano', '$funcionario_rut', '$funcionario_nombre', '$hermano_rut', '$hermano_nombre', '$egresado_rut', '$egresado_nombre', '$motivo', '$motivo_otro')";
$resultado = mysqli_query($conexion, $query);