•
•
•
•
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
![]() |
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
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
•
•
Join Date: Nov 2003
Location: Toronto, Canada
Posts: 354
Reputation:
Rep Power: 6
Solved Threads: 5
You'll need to explain your problem more clearly. I have a hard time understanding what you are trying to accomplish.
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...
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!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
advertisment blog browser cell competition daniweb email encryption eu eudora firefox gentoo gmail google imap linux microsoft mobile mozilla news onecare open source opinion outlook penelope phishing phones php professional research scam security spam spammers spamming stocks technology thunderbird virus web webmail
- DaniWeb Folding@Home Team (Geeks' Lounge)
- Automatic email creation in cpanel ----PHP (PHP)
- Encouraging Registration Vs. (Growing an Online Community)
- Please Help Me (Java)
- Doesn't check if username or email exits in database properly (ASP.NET)
- Registration form help (ColdFusion)
- big trouble with signing in (Web Browsers)
Other Threads in the PHP Forum
- Previous Thread: username=email address inputted on submission>is this possible
- Next Thread: Creating an else to a for loop


Linear Mode