This is a clone: (currently no response)
I try to create a form I am getting that value passed from $ _ request . - A field is displayed only when the $ _REQUEST variable is present (done)
- The user
- The field can be modified
- The field is valid in any way
- (modified) value is used
In this specific case, Using the user function, but I hope the solution applies to any drop form.
Here is a simplified version of my code where there is an additional field to specify the user, they have a favorite result, if they want to register using the following URL:
Freeware_user ($ op, $ edit, & $ user, $ category = NULL) {switch ($ op) {// Add additional fields if their case 'register' in $ _REQUEST The values for: if ($ _ request ['fruit'] == 'pineapple') {$ fields ['user_reg_info'] ['Profile_fruit'] = array ('#type' => gt; Stfild '# Description' = & gt; 'your favorite fruit (if applicable)', '# Lock' = & gt; 0, '# value' = & gt; $ _REQUEST [ 'fruit']); } Return $ fields; break; In case of mistakes, check the check for 'check' 'valid': if ($ edit ['form_id'] == 'user_register') {if ($ edit ['profile_fruit']) {verify_fruit ($ Edit ['profile_fruit']); } } break; // New user goes after 'insert case': if ($ _ request ['fruit']) {db_query ('INSERT INTO user_fruits SET `uid` =% d`fruit` ="% s "', array ($ User- & gt; uid, $ [[profile_fruit '] edit)); } // record information watchdog ('user', t ('user% user has taken a single result', array ('% user' = & gt; $ user- & gt; name))); break; }} With the above code, the field itself appears when $ _ request ['fruit'] is present, but if you use your " Watermelon ", the insert still uses" pineapple ".
I think you are using two different keys while inserting and registering. You can edit the $ field ['user_reg_info'] ['profile_fruit'] in the register and in the insert ['fruit']. Use both the ['fruits'] keys at the same place besides using the same in editing.
Comments
Post a Comment