• Brandon

    (@bjchristensen)


    Right now I am trying to have the user update certain information via a form, which would update their meta table. The user is currently logged in and will be updating their own information (on front end). Below is the code. Can’t seem to get it to update the user_meta table. Once I get it updated, I want to display it in a dropdown field along.

    <form method="post" action="<?php echo $_SERVER[PHP_SELF];?>">
                  <label><?php _e('field1:'); ?></label>
                    <input class="field1" name="field1_update" type="text">
                  <label><?php _e('field2:'); ?></label>
                    <input class="field2" name="field2_update" type="text">
                  <label><?php _e('field3:'); ?></label>
                    <input class="field3" name="field3_update" type="text">
                  <label><?php _e('field4'); ?></label>
                    <input class="field4" name="field4_update" type="text"><br /><br />
                  <input type="submit" name="Submit" value="Update" />
              </form>
                  <?php
    
                  if(isset($_POST['Update'])){
                      $field1_update = $_POST['field1_update'];
                      $field2_update = $_POST['field2_update'];
                      $field3_update = $_POST['field3_update'];
                      $field4_update = $_POST['field4_update'];
                 } 
    
                 update_user_meta( $user_id, 'field1', $field1_update, 'field2_name', $field2_update, 'field3_name', $field3_update, 'field4_name', $field4_update; );
    
                  ?>
  • The topic ‘Issue updating user meta via form’ is closed to new replies.