How to make and save custom form in custom plugin page?


Hi I am very new in WordPress plugin development. I am make a plugin with setting page in it and in its setting page i need a user registration for with only two fields username and password but not bale to save this data in database please guide me.

Here is what I am trying to do

public function PLUGIN_setting_page(){
    require_once PLUGIN_PATH. 'templates/admin/plugin-settings.php';


if(isset($_POST['submit'])) {
   global $wpdb;
   $table = 'wp_myp_user';
   $data = array(
      'username' => $_POST['username'],
      'password'    => $_POST['password']
   $format = array(
   $success=$wpdb->insert( $table, $data, $format );
       echo 'data has been save' ; 
<div class="login-page">
  <div class="form" method="post" action="">
    <form class="login-form">
      <input type="text" name="ldc_username" placeholder="username" value=""/>
      <input type="password" name="ldc_password" placeholder="password" value=""/>
      <!-- <button type="submit">login</button> -->
      <?php submit_button(); ?>
Mohit 2 months 0 Answers 10 views 0

Leave an answer