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

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.onsubmit = "assignUsername";

function assignUsername() {
document.forms.username.value = document.forms.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...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.