1

So I have the following function with an array of variables that handles a profile form. All but one is a typical input with the exception of 'member-comptency[]'. It's a select field field with several possible values. Right now, the form saves, all the data comes through as expected with the exception of that field which simply returns a number.

I've tried in vain several times to modify this in different ways, but only produces a 'no-save' situation, or further non-descrip errors. I understand this field is an array itself, but not sure how to even ask google the right questions to get myself on track.

Any help would certainly be appreciated!

function getUMFormData(){
    $id = um_user('ID');
        $names = array(
            'member-company',
            'member-phone',
            'member-website',
            'member-competency[]',
            'member-contact-billing-name'
        );

        foreach( $names as $name )
        update_user_meta( $id, $name, $_POST[$name] );
}
        

1 Answer 1

0

This is not a WordPress-specific question, and without seeing your form code it's hard to say, but what is obviously wrong is that you are referring to the variable with the [] in the name. Try removing them and test again. If not, I suggest var_dumping the $_POST variable and seeing what it contains and working from there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.