0

I am facing a issue in elementor form.The issue is that when i submit the data of elementor form all the otheer data can save in the array but the files data or not save in that array what can i do now.When i ask about this issue to CHATGPT it says that Ensure that the form has the enctype="multipart/form-data" attribute: This attribute is necessary when you have file inputs in your form. It allows the form to handle file uploads correctly. In the code you provided, the form element already has this attribute, so this may not be the issue.

that is the function.php code

add_action('wp_ajax_save_business_data', 'save_business_data');
add_action('wp_ajax_nopriv_save_business_data', 'save_business_data');
function save_business_data() {
    parse_str($_POST['form_data'], $form_data);


    print_r($_FILES);
    print_r($form_data);
    die();

that is the ajax code for check the data of the elementor form

jQuery(".elementor-form").on("submit",function(e){
        e.preventDefault();
        
        var ajaxUrl = '/wp-admin/admin-ajax.php'; 
        jQuery.ajax({
            url: ajaxUrl, // The AJAX URL defined in WordPress
            type: 'POST',
            data: {
                action: 'save_business_data',
                form_data: jQuery(this).serialize()
            },
            success: function(response) {
                console.log(response);
                // Handle the success response
                // console.log('Business data saved');
            },
            error: function(error) {
                // Handle the error response
                console.log('Error saving business data');
            }
        });
    })

all the other data are comming but not the field's or values of the elementor form are comming

Sa786
  • 1

0 Answers0