Topic: Adding Fields to Registration
Hello,
I have tried to add new fields to my registration, for example, to gather gender, age, ect.
Now, I have added the following after the timezone part:
<div class="inform">
<fieldset>
<legend>Choose your Gender</legend>
<div class="infldset">
<label>
<select id="gender" name="gender">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div>
</fieldset>
</div>
I found this:
$timezone = intval($_POST['timezone']);
and added the following right after:
$gender = isset($_POST['gender']);
I have also modified my sql query from:
$db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, save_pass, timezone, faction, language, style, registered, registration_ip, last_visit) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$save_pass.', '.$timezone.', '.$faction.', \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error());
To:
$db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, save_pass, timezone, faction, language, style, registered, registration_ip, last_visit, gender) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$save_pass.', '.$timezone.', '.$faction.', \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.', '.$gender.')') or error('Unable to create user', __FILE__, __LINE__, $db->error());
My SQL for gender is:
Varchar(50)
Can anyone please tell me how to do this in easy to follow steps, I really have tried everything I could..
Thanks, ultime