Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 503655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:24:58+00:00 2026-05-13T06:24:58+00:00

I needed to create a custom select list for the user registration page that

  • 0

I needed to create a custom select list for the user registration page that pulls a SQL query from nodes I need to link to users. I have successfully accomplished this task.. 🙂

However, when I submit the value, I can’t seem to control where the value is stored. In fact, I can’t store the value at all. I have created a custom field for my value, but only the new field name is stored, and it is serialized and stored in the Data column of the user table.

Below is my code, I’ve commented my issues in it. Any help would be appreciated!

 <?php
    // $Id$

       //create the additional user form field, a select list named "account_name"
       //then calls the next function to populate it.
      function accountselect_user($op, &$edit, &$account, $category = NULL) {
        if ($op == 'register' || 'edit')
        $fields['Information']['account_name'] = array(
        '#type' => 'select',
        '#title' => 'Account',
        '#description' => t('Select the account to which the contact belongs'),
        '#options' => accountselect_getclubs() ,
        );
        return $fields;
      }

      //contains query to pull results to select list...this part is working
      function accountselect_getclubs() {
          $return = array();
          $sql = 'SELECT DISTINCT `title` FROM node WHERE type = \'accounts\' ';
          $result = db_query($sql);
        while ($row = db_fetch_array($result)) {
           $return[] = $row['title'];
         }

        return $return;
      }

      //CAN'T GET THIS PART TO WORK - query to update the row - the uid = 29 is for
      //testing puposes. Once I get the test value to work
      //the test value I will worry about updating the correct user.
      function accountselect_submitaccount() {
         $sql = "UPDATE users SET account = \'value\' WHERE uid = \'29\'";
         db_query($sql);
         drupal_set_message(t('The field has been updated.'));
      }

      //I SUSPECT THE PROBLEM IS HERE...call the submitaccount function.
      //I have tried hook_form_alter as well...
      function accountselect_submit(&$form, &$form_state) {
        if($form_id == 'user-register')
        drupal_execute('accountselect_submitaccount');
      }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:24:58+00:00Added an answer on May 13, 2026 at 6:24 am

    Have you checked Drupal’s logs? It should be throwing errors, as this is not a valid query.

    $sql = "UPDATE users SET account = \'value\' WHERE uid = \'29\'";
    

    Should be:

    $sql = "UPDATE users SET account = 'value' WHERE uid = '29'";
    

    Additionally, in:

    function accountselect_submit(&$form, &$form_state) {
      if($form_id == 'user-register')
      drupal_execute('accountselect_submitaccount');
    }
    

    $form_id is never defined.

    You say you’ve created the field in the database, but it must match the name of the Drupal field to be automatically handled. You’ve got two different names for it – account_name in the Drupal field, but account in the database. Make them consistent and it should be automatically handled, no submit functions required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 296k
  • Answers 296k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer At some point, they need to be converted to integers… May 13, 2026 at 7:02 pm
  • Editorial Team
    Editorial Team added an answer If you enclose the value within single quotes, the YAML… May 13, 2026 at 7:02 pm
  • Editorial Team
    Editorial Team added an answer Invalidate marks the window as needing to be refreshed (at… May 13, 2026 at 7:02 pm

Related Questions

I have recently(today) began meddeling with my registry from within Delphi. :) all is
I need to import a csv file into Firebird and I've spent a couple
I'm binding a query to a WinForms DataGridView . I want the column headers
We have build a intranet application where users have to login to do certain
this will be quite difficult to explain. I hope I'm able to. I recently

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.