Support

Account

Home Forums General Issues submit data from a form Reply To: submit data from a form

  • I tried that and didn’t have any luck there either…

    This is my code at the moment:

    function generate_grading_application_cpt() {
    if (isset( $_POST['submit'] ) ) {
    
        $formStudNum = $_POST['student-number'];
    	$formDojang = $_POST['dojang'];
    	$formInstructor = $_POST['instructor'];
    	$formCurrentRank = $_POST['current-rank'];
    
    $cpt_post_args = array(
    	'post_title'     => $_POST['full-name'],
    	'post_status'    => 'publish',
    	'post_type'      => 'grading_applications',
    );	
    // 	Student Number Field
    	$field_key = "field_5ec64e12429be";
    	$value = $formStudNum;
    	update_field( $field_key, $value, $post_id );
    	
    //  Dojang Field
    	$field_key = "field_5ec64f26429bf";
    	$value = $formDojang;
    	update_field( $field_key, $value, $post_id );
    	
    //  Instructor Field
    	$field_key = "field_5ec64f36429c0";
    	$value = $formInstructor;
    	update_field( $field_key, $value, $post_id );
    	
    //  Current Rank Field
    	$field_key = "field_5ec64f5e429c1";
    	$value = 	$formCurrentRank;
    	update_field( $field_key, $value, $post_id );
    
    // insert the post into the database
    
    $cpt_id = wp_insert_post( $cpt_post_args, $wp_error);
    }
    };
    add_action( 'template_redirect', 'generate_grading_application_cpt' );

    https://imgur.com/41uMEkJ – Screen Shot of ACF fields

    Anything obvious I’m missing. ACF fields are very new to me…