I thought I had everything right, but apparently not. I'm trying to add a select menu to the registration form using the custom registration code. Actually, I have the menu working correctly, but when I try registering, I get an SQL error indicating that the option value isn't being translated to the query.
Can someone direct me where I need to go for this? The code I'm working with - which is a modification to COM_optionList - and is located just above the custom_userform function is:
Text Formatted Code
function COM_locationList( $table, $selection, $selected='', $sortcol=1 )
{
$retval = '';
$tmp = str_replace( 'DISTINCT ', '', $selection );
$select_set = explode( ',', $tmp );
$result = DB_query ("SELECT $selection FROM $table WHERE grp_name LIKE '%Region%' ORDER by grp_name");
$nrows = DB_numRows( $result );
for( $i = 0; $i < $nrows; $i++ )
{
$A = DB_fetchArray( $result );
$retval .= '<option value="' . $A[0] . '"';
if( $A[0] == $selected )
{
$retval .= ' selected="selected"';
}
$retval .= '>' . $A[1] . '</option>' . LB;
}
return $retval;
}
I then have this within the custom_userform function:
Text Formatted Code
$selection = '<select name="location_select">' . LB;
$selection .= COM_locationList ($_TABLES['groups'], 'grp_id,grp_name', $A['grp_id']);
$selection .= '</select>';
To add the select list to the template, I added this:
Text Formatted Code
$user_templates->set_var('message', $message);
$user_templates->set_var('location_selector', $selection);
$user_templates->set_var('ug_main_grp_id', $A['0']);
I then have the DB_query under the custom_usercreate function:
Text Formatted Code
DB_query("INSERT INTO {$_TABLES['group_assignments']}
(ug_main_grp_id, ug_uid)
VALUES ($A[0],$uid)");
Obviously, $A[0] isn't what I need in the query, but I've tried pretty much every thing else. Anyone have any ideas?
And please, I already feel stupid from another question I asked earlier, so if I'm missing something obvious, please break it to me gently...