SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Non-Member
    Join Date
    Apr 2007
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Combining User Name and Email address

    I'm using program with a Create Account Page. It asks for User Name, Password, Email Address etc., I want the User Name to be the Users Email Address, is there a way to combine these, so that the User Name is the email address?

    I'm not to familiar with code or values, but User Name shows:
    value='<?=$account->user_name ?>'>
    And the email address shows:
    value='<?=$account->email ?>'>

    Is there any way to combine these?

    Thank you. Here is the code:

    <?php global $account; ?>

    <form method="POST" action="index.php">
    <table align="center" cellpadding="1" width="70%" height="100%">
    <tr><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td></tr>
    <input class='field' type='hidden' name='command' value='account'>
    <input class='field' type='hidden' name='param' value='signup'>
    <tr><td colspan='2' class='pageTitle'><div class='hLine'>Create new account</div></td></tr>
    <tr><td>&nbsp;</td></tr>
    <tr>
    <td class='fieldLabel' width="30%">Membership type</td>
    <td align="center">[account_type_panel]</td></tr>
    <tr><td>&nbsp;</td></tr>
    <tr>
    <td class='fieldLabel' width="30%">User Name</td>
    <td><input class='field' type='text' size='30' maxlength="30" name='user_name' value='<?=$account->user_name ?>'>
    <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('user_name') ?></span></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Password</td>
    <td><input class='field' type='password' size='30' maxlength="30" name='password' value='<?=$account->password ?>'>
    <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('password') ?></span></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Re-enter Password</td>
    <td><input class='field' type='password' size='30' maxlength="30" name='reenter_password' value='<?=$account->reenter_password ?>'>
    <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('reenter_password') ?></span></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Name </td>
    <td ><input class='field' type='text' size='40' maxlength="50" name='first_name' value='<?=$account->first_name ?>'>
    <span class='requiredField'>&nbsp;*&nbsp</span><span class='errorMessage'><?=$account->get_error('first_name') ?></span></td>

    </tr>
    <tr>
    <td class='fieldLabel'>business / company name</td>
    <td><input class='field' type='text' size='40' maxlength="50" name='last_name' value='<?=$account->last_name ?>'>
    <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('last_name') ?></span></td>
    </tr>
    <tr><td>&nbsp;</td></tr>
    <tr>
    <td class='fieldLabel'>Email address</td>
    <td><input class='field' type='text' size='40' maxlength="50" name='email' value='<?=$account->email ?>'>
    <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('email') ?></span></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Address</td>
    <td><input class='field' type='text' size='40' maxlength="70" name='address' value='<?=$account->address ?>'>
    <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('address') ?></span></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Address 2</td>
    <td><input class='field' type='text' size='40' maxlength="70" name='address_second' value='<?=$account->address_second ?>'></td>

    </tr>
    <tr>
    <td class='fieldLabel'>City</td>
    <td><input class='field' type='text' size='40' maxlength="50" name='city' value='<?=$account->city ?>'>
    <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('city') ?></span></td>
    </tr>

    <tr>
    <td class='fieldLabel'>Zip/Postal code</td>
    <td><input class='field' type='text' size='35' maxlength="35" name='zip_postal_code' value='<?=$account->zip_code ?>'>
    <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('zip_code') ?></span></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Phone Number</td>
    <td><input class='field' type='text' size='35' maxlength="35" name='phone' value='<?=$account->phone ?>'></td>
    </tr>
    <tr>
    <td class='fieldLabel'>Mobile Phone Number</td>
    <td><input class='field' type='text' size='35' maxlength="35" name='mobile_phone_number' value='<?=$account->mobile_phone_number ?>'></td>
    </tr>
    <tr><td>&nbsp;</td></tr>



    <tr><td>&nbsp;</td></tr>
    <tr><td colspan="2" class='hLine' align="right">&nbsp;<span class='requiredField'>&nbsp;*</span>&nbsp;&nbsp; Required field</td></tr>
    <tr><td colspan='2' align="right"><input class='button' type='submit' value='create'></td></tr>
    <tr><td colspan="2">&nbsp;</td></tr>
    </table>
    </form>

  2. #2
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,563
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change
    PHP Code:
    value='<?=$account->user_name ?>'>
    to
    PHP Code:
    value='<?=$account->email ?>'>

  3. #3
    Non-Member
    Join Date
    Apr 2007
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks, but.....

    Thanks for your reply. But if I make the change you're suggesting, after the account is created, will the user be able to log-in with his email address as the user name?

  4. #4
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,563
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You know, the best would be

    1. Delete this entirely

    PHP Code:
    <tr>
    <td class='fieldLabel' width="30%">User Name</td>
    <td><input class='field' type='text' size='30' maxlength="30" name='user_name' value='<?=$account->user_name ?>'>
    <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('user_name'?></span></td>
    </tr>
    2. Move this above

    PHP Code:
    <tr>
    <td class='fieldLabel'>Email address</td>
    <td><input class='field' type='text' size='40' maxlength="50" name='email' value='<?=$account->email ?>'>
    <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('email'?></span></td>
    </tr>
    3. Last, change the code that checks while user enter log in information in the sign up page. Now it's checking for usernames, make it check for email.

  5. #5
    Non-Member
    Join Date
    Apr 2007
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks

    Thanks for your reply.

    I will replace the one code with the code you suggested. But I'm not clear on your instructions "change the code that checks while user enter log in information in the sign up page".

    Can you clarify what you're instructing? How/where do I do this?

    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •