title: Data storing in the Database, Wordpress WooCommerce
body: <p>I am currently coding the following, and don't seem to get my database to interact with woocommerce, this is a sign up/register form, so the information basically just needs to be posted to the database so its logged for when the user needs to use it? I have however managed to get it to logged everything such as password/first name etc, but nothing to do with woocommerce such as billing address, here is my code hope you can help!</p>
  
  <pre><code>&lt;div id="content"&gt;
  &lt;div class="titlebox" &gt;&lt;center&gt;&lt;?php the_title(); ?&gt;&lt;/center&gt;&lt;/div&gt;
  
  &lt;div class="description"&gt;
  &lt;center&gt;
  &lt;strong&gt;&lt;h2&gt;Create an Account&lt;/h2&gt;&lt;/strong&gt;
  &lt;/center&gt;
  &lt;/div&gt;
  
  &lt;?php
  $err = '';
  $success = '';
  
  global $wpdb, $PasswordHash, $current_user, $user_ID;
  
  if(isset($_POST['task']) &amp;&amp; $_POST['task'] == 'register' ) {
  
      $pwd1 = $wpdb-&gt;escape(trim($_POST['pwd1']));
      $pwd2 = $wpdb-&gt;escape(trim($_POST['pwd2']));
      $first_name = $wpdb-&gt;escape(trim($_POST['first_name']));
      $last_name = $wpdb-&gt;escape(trim($_POST['last_name']));
      $description = $wpdb-&gt;escape(trim($_POST['description']));
      $email = $wpdb-&gt;escape(trim($_POST['email']));
      $username = $wpdb-&gt;escape(trim($_POST['username']));
      $url = $wpdb-&gt;escape(trim($_POST['url']));
      $aim = $wpdb-&gt;escape(trim($_POST['aim']));
      $yim = $wpdb-&gt;escape(trim($_POST['yim']));
      $jabber = $wpdb-&gt;escape(trim($_POST['jabber']));
      $googleplus = $wpdb-&gt;escape(trim($_POST['googleplus']));
      $billing_first_name = $wpdb-&gt;escape(trim($_POST['billing_first_name']));
      $billing_last_name = $wpdb-&gt;escape(trim($_POST['billing_last_name']));
      $billing_company = $wpdb-&gt;escape(trim($_POST['billing_company']));
      $billing_address_1 = $wpdb-&gt;escape(trim($_POST['billing_address_1']));
      $billing_address_2 = $wpdb-&gt;escape(trim($_POST['billing_address_2']));
      $billing_city = $wpdb-&gt;escape(trim($_POST['billing_city']));
      $billing_postcode = $wpdb-&gt;escape(trim($_POST['billing_postcode']));
      $billing_state = $wpdb-&gt;escape(trim($_POST['billing_state']));
      $billing_country = $wpdb-&gt;escape(trim($_POST['billing_country']));
      $billing_phone = $wpdb-&gt;escape(trim($_POST['billing_phone']));
      $billing_email = $wpdb-&gt;escape(trim($_POST['billing_email']));
  
      if( $email == "" || $pwd1 == "" || $pwd2 == "" || $username == "" || $first_name == "" || $last_name == "" || $description == "" ) {
          $err = 'Please don\'t leave the required fields.';
      } else if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
          $err = 'Invalid email address.';
      } else if(email_exists($email) ) {
          $err = 'Email already exist.';
      } else if($pwd1 &lt;&gt; $pwd2 ){
          $err = 'Password do not match.';        
      } else {
          $user_id = wp_insert_user( array (
          'first_name'    =&gt; apply_filters('pre_user_first_name', $first_name), 
          'last_name'     =&gt; apply_filters('pre_user_last_name', $last_name),
          'url'           =&gt; apply_filters('pre_user_url', $url),
          'aim'           =&gt; apply_filters('pre_user_aim', $aim),
          'yim'           =&gt; apply_filters('pre_user_yim', $yim),
          'jabber'        =&gt; apply_filters('pre_user_jabber', $jabber),
          'googleplus'    =&gt; apply_filters('pre_user_googleplus', $googleplus),
          'description'   =&gt; apply_filters('pre_user_description', $description), 
          'user_pass'     =&gt; apply_filters('pre_user_pass', $pwd1), 
          'user_login'    =&gt; apply_filters('pre_user_login', $username), 
          'user_email'    =&gt; apply_filters('pre_user_email', $email), 
          'role'          =&gt; 'subscriber' 
          ) );
          if( is_wp_error($user_id) ) {
              $err = 'Error on user creation.';
          } else {
              do_action('user_register', $user_id);
  
              $success = 'You\'re successfully register';
          }
      }
  }
  ?&gt;
  
  &lt;div id="message"&gt;
      &lt;?php 
          if(! empty($err) ) :
              echo '&lt;p class="error"&gt;'.$err.'&lt;/p&gt;';
          endif;
      ?&gt;
  
      &lt;?php 
          if(! empty($success) ) :
              echo '&lt;p class="error"&gt;'.$success.'&lt;/p&gt;';
          endif;
      ?&gt;
  &lt;/div&gt;
  
  &lt;form method="post"&gt;
      &lt;h3&gt;Create Account.&lt;/h3&gt;
      &lt;p&gt;&lt;label&gt;Last Name&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="last_name" id="last_name" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;First Name&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="first_name" id="first_name" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Description&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="description" id="description" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;url&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="url" id="url" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;aim&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="aim" id="aim" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;yim&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="yim" id="yim" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;jabber&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="jabber" id="jabber" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;googleplus&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="googleplus" id="googleplus" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Email&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="email" id="email" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Username&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="username" id="username" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Password&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="password" value="" name="pwd1" id="pwd1" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Password again&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="password" value="" name="pwd2" id="pwd2" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Billing First Name&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="billing_first_name" id="billing_first_name" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Billing Second Name&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="billing_last_name" id="billing_last_name" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Billing Company&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="billing_last_name" id="billing_last_name" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Billing Address Line 1&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="billing_address_1" id="billing_address_1" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Billing Address Line 2&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="billing_address_2" id="billing_address_2" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Billing City&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="billing_city" id="billing_city" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Billing Postcode&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="billing_postcode" id="billing_postcode" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Billing State&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="billing_state" id="billing_state" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Billing Country&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="billing_country" id="billing_country" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Billing Phone&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="billing_phone" id="billing_phone" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label&gt;Billing Email&lt;/label&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="text" value="" name="billing_email" id="billing_email" /&gt;&lt;/p&gt;
      &lt;div class="alignleft"&gt;&lt;p&gt;&lt;?php if($sucess != "") { echo $sucess; } ?&gt; &lt;?php if($err != "") { echo $err; } ?&gt;&lt;/p&gt;&lt;/div&gt;
      &lt;button type="submit" name="btnregister" class="button" &gt;Submit&lt;/button&gt;
      &lt;input type="hidden" name="task" value="register" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p></p>
  
  <p></p>