php - In Wordpress, how to code a custom form with file upload option and save the records in MySql? - Stack Overflow

PHOTO EMBED

Wed Sep 22 2021 20:42:21 GMT+0000 (UTC)

Saved by @khalidlogi

if(isset($_POST['BtnSubmit'])) {
    global $wpdb;
    $data_array = array(
                        'myname' => $_POST['myname'],
                        'statename'  => $_POST['statename'],

                        );

    $table_name = 'form_entry';
    $rowResult = $wpdb ->insert($table_name, $data_array, $format=NULL);

    if($rowResult == 1) {
        echo 'Success';
    }
else {
    echo ' Error in my pant';
}   
die;
}
content_copyCOPY

https://stackoverflow.com/questions/48050409/in-wordpress-how-to-code-a-custom-form-with-file-upload-option-and-save-the-rec