Create Account
Sign In

adding group in register.php

To create and answer topics, you must to be logged.
Pages: 1
Author Message
testingkp
12/01/2014 at 21:30:54
testingkp
Member
hya im wanting to add a select option group in signup.php ive done the following so far but when i fill in form to reg new user i stay in signup.php ive underlined the changes to be looked at am i missing something any help would be gr8 ty jan x

<?php
//We check if the form has been sent
if(isset($_POST['username'], $_POST['password'], $_POST['passverif'], $_POST['email'], $_POST['age'], $_POST['group'], $_POST['avatar']) and $_POST['username']!='')
{
//We remove slashes depending on the configuration
if(get_magic_quotes_gpc())
{
$_POST['username'] = stripslashes($_POST['username']);
$_POST['password'] = stripslashes($_POST['password']);
$_POST['passverif'] = stripslashes($_POST['passverif']);
$_POST['email'] = stripslashes($_POST['email']);
$_POST['age'] = stripslashes($_POST['age']);
$_POST['group'] = stripslashes($_POST['group']);
$_POST['avatar'] = stripslashes($_POST['avatar']);
}
//We check if the two passwords are identical
if($_POST['password']==$_POST['passverif'])
{
//We check if the password has 6 or more characters
if(strlen($_POST['password'])>=6)
{
//We check if the email form is valid
if(preg_match('#^(([a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+\.?)*[a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+)@(([a-z0-9-_]+\.?)*[a-z0-9-_]+)\.[a-z]{2,}$#i',$_POST['email']))
{
//We protect the variables
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
$email = mysql_real_escape_string($_POST['email']);
$age = mysql_real_escape_string($_POST['age']);
$group = mysql_real_escape_string($_POST['group']);
$avatar = mysql_real_escape_string($_POST['avatar']);
//We check if there is no other user using the same username
$dn = mysql_num_rows(mysql_query('select id from users where username="'.$username.'"'));
if($dn==0)
{
//We count the number of users to give an ID to this one
$dn2 = mysql_num_rows(mysql_query('select id from users'));
$id = $dn2+1;
//We save the informations to the databse
if(mysql_query('insert into users(id, username, password, email, age, group, avatar, signup_date) values ('.$id.', "'.$username.'", "'.$password.'", "'.$email.'", "'.$group.'", "'.$age.'", "'.$avatar.'", "'.time().'")'))
{
//We dont display the form
$form = false;
?>

<html>

<tr>
<td>Group</td>
<td><select size="group">
<option value="1">Female</option>
<option value="2">Male</option>
<option value="3">CoupleMF</option>
<option value="4">CoupleFF</option>
<option value="5">CoupleMM</option>
<option value="6">Tv/ts/cd</option>
</select></td>
</tr>

Pages: 1