Insert data into Wordpress database table from a custom form

后端 未结 2 706
闹比i
闹比i 2021-02-01 10:20

I am trying to insert data into Wordpress database by creating a table. I have created the table but when I try to insert the data from form, it does not insert the data. I have

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-01 10:55

    You can use this

    prefix.'post_job';
    
        $data=array(
            'organizationname' => $_POST['organizationname'], 
            'post' => $_POST['post'],
            'publishfrom' => $_POST['publishfrom'], 
            'publishupto' => $_POST['publishupto'],
            'qualification1' => $_POST['qualification1'], 
            'qualification2' => $_POST['qualification2'], 
            'qualification3' => $_POST['qualification3'],
            'qualification4' => $_POST['qualification4'], 
            'experience1' => $_POST['experience1'], 
            'experience2' => $_POST['experience2'],
            'experience3' => $_POST['experience3'], 
            'training1' => $_POST['training1'], 
            'training2' => $_POST['training2'], 
            'training3' => $_POST['training3'],
            'training4' => $_POST['training4'], 
            'training5' => $_POST['training5'] );
    
    
         $wpdb->insert( $tablename, $data);
    }
    
    ?>
    

提交回复
热议问题