User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,596 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,706 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1349 | Replies: 2
Reply
Join Date: Apr 2005
Location: Kerala
Posts: 156
Reputation: hbmarar is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
hbmarar's Avatar
hbmarar hbmarar is offline Offline
Junior Poster

email=username in_form

  #1  
Nov 4th, 2005
hi,

I have started programming (learning) to free myself from depencies.I do not know how to do the below.

i made a form that has a input box for emai and two passord inputboxexs.on submit i have to pass the same email inputbox value as the hidden value for username.In brief the username and the email should be same in the database.the database fileds are username,email,password. I request the members to help me how to do this.
<input type="hidden" name="username" value=form.email.value />this i tried but there is some error.

Hope someone would help me with this
Wishing you all a nice day

Harish
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2003
Location: Toronto, Canada
Posts: 354
Reputation: Gary King will become famous soon enough Gary King will become famous soon enough 
Rep Power: 6
Solved Threads: 5
Colleague
Gary King's Avatar
Gary King Gary King is offline Offline
PHP/vBulletin Guru

Re: email=username in_form

  #2  
Nov 6th, 2005
You'll need to explain your problem more clearly. I have a hard time understanding what you are trying to accomplish.
Reply With Quote  
Join Date: Sep 2005
Posts: 639
Reputation: digital-ether has a spectacular aura about digital-ether has a spectacular aura about 
Rep Power: 5
Solved Threads: 38
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Practically a Master Poster

Re: email=username in_form

  #3  
Nov 7th, 2005
Hi Harish,

To assign the value of the email field to the username field, you would have to use javascript.

It would be something like:

(i havent tested the js)
<script>
document.forms['formname'].onsubmit = "assignUsername";

function assignUsername() {
document.forms['formname'].username.value = document.forms['formname'].email.value;
}
</script>
(you will have to change formname to the name of your form.)

However...
You do not need to have the hidden field for the username. If it is the same as the email, then on the php script that handles the form, you can just use the email as if its the username.

In reality however, you really dont need to have a username field in your database, if it is the same as the email address. It is only redundant and takes up more space in your database... One of the good rules of creating a database is to remove redundancy, yet at the same time keep every row in the database unique. This is already achieved by a unique email address. It is still better even if you have an id for each row, that auto increments.

cheers...
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 11:33 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC