Pls help me

pls help me out anyone ,i have create fields tables in database ok,but these details which user will regester with details,how should i connect database so that i can view users details in myphpadmin.

firstname,lastname,username,password,confirm password,email,confirm email,date of birth,gender,state,country. i have created fields,in database,but to details of users when they register in this register form which i have created.

Iam using dreamweaver cs4. just started creating website,and stuck in register form.

<html><title>registerform</title>
<boby>
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\
';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\
';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\
';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\
'; }
    } if (errors) alert('The following error(s) occurred:\
'+errors);
    document.MM_returnValue = (errors == '');
} }
//-->
</script>
<style type="text/css">
<!--
body {
	background-image: url(images/bg_16.gif);
	color: #F00;
	font-size: 18px;
}
-->
</style><link href="register_css.htm" rel="stylesheet" type="text/css">
<form action="register.php" method="POST"> 
  <blockquote onClick="MM_validateForm('firstname','','R');return document.MM_returnValue">
    
           
  
  <table width="50%" height="726" border="6" align="center" cellpadding="4" cellspacing="20" id="register.form">
    <tr>
      <td align="right" bgcolor="#33FFFF">Firstname:</td>
      <th align="left" bgcolor="#33FFFF"><input name="firstname" type="text" id="firstname" maxlength="50"></th>
    </tr>
    <tr>
      <td align="right" bgcolor="#33FFFF">Lastname:</td>
      <td align="left" bgcolor="#33FFFF"><input name="lastname" type="text" id="lastname" maxlength="50"></td>
    </tr>
    <tr class="username">
      <td align="right" bgcolor="#33FFFF"><label for="username">Username:</label></td>
      <td align="left" bgcolor="#33FFFF" class="username"><input name="username" type="text" id="username" maxlength="50"></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#33FFFF"><label for="password">Password:</label></td>
      <td align="left" bgcolor="#33FFFF"><input name="password" type="password" id="password" maxlength="50"></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#33FFFF">Confirm Password :</td>
      <td align="left" bgcolor="#33FFFF"><input type="text" name="confirmpassword" id="confirmpassword"></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#33FFFF"><label for="email">Email:</label></td>
      <td align="left" bgcolor="#33FFFF"><input type="text" name="email" id="email"></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#33FFFF"><label for="confirmemail3">Confirm Email:</label></td>
      <td align="left" bgcolor="#33FFFF"><input type="text" name="confirmemail" id="confirmemail3"></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#33FFFF"><label for="dateofbirth">Date of Birth:</label></td>
      <td align="left" bgcolor="#33FFFF"><input type="text" name="dateofbirth" id="dateofbirth"></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#33FFFF"><label for="gender">Gender:</label></td>
      <td align="left" bgcolor="#33FFFF"><select name="gender" id="gender">
        <option SELECTED >-select-</option>
        <option value="m">Male</option>
        <option value="f">Female</option>
      </select></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#33FFFF"><label for="address">      Address:</label></td>
      <td align="left" bgcolor="#33FFFF"><p>
        <label for="textfield"></label>
      
        <input type="text" name="address" id="address">
      </p></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#33FFFF"><label for="pincode">Pincode:</label></td>
      <td align="left" bgcolor="#33FFFF"><input type="text" name="pincode" id="pincode"></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#33FFFF">State:</td>
      <td align="left" bgcolor="#33FFFF"><input type="text" name="state" id="state"></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#33FFFF">Country:</td>
      <td align="left" bgcolor="#33FFFF"><input type="text" name="counrty" id="counrty"></td>
    </tr>
  </table>
<p>&nbsp;</p>
       <p>
                          
       <input name="submit" type="submit" id="submit" onClick="MM_validateForm('firstname','','R','lastname','','R','username','','R','password','','R','confirmpassword','','R','email','','RisEmail','confirmemail','','RisEmail','dateofbirth','','R','address','','R','pincode','','RisNum','state','','R','counrty','','R');return document.MM_returnValue" value="register">
                        </p>
                      
</form>
</body>
</html>

I think you need to read some good PHP & MySQL books to start with PHP and MySQL database connection and all. And also you should know some global arrays in PHP that are available for HTML form values like $_POST (or GET).
If you already know about the form submission then your register.php file should look like this:


// Make a MySQL Connection
mysql_connect("localhost", "dbuser", "dbpassword") or die(mysql_error());
// Select a database already created in mysql
mysql_select_db("test") or die(mysql_error());

// Now prepare your insert statement
$sql = "INSERT INTO tblusers SET 
            firstname='" . mysql_real_escape_string($_POST['firstname']) . "',
            lastname='" . mysql_real_escape_string($_POST['firstname']) . "',
            username='" . mysql_real_escape_string($_POST['firstname']) . "',
            password='" . mysql_real_escape_string($_POST['firstname']) . "'
            email='" . mysql_real_escape_string($_POST['firstname']) . "'
            date_of_birth='" . mysql_real_escape_string($_POST['firstname']) . "',
            gender='" . mysql_real_escape_string($_POST['firstname']) . "',
            state='" . mysql_real_escape_string($_POST['firstname']) . "',
            country='" . mysql_real_escape_string($_POST['firstname']) . "'";
// now execute the query
mysql_query($sql) or die(mysql_error());

I don’t think that you need to store confirmed password and email two times in the database. You can just check them to validate them whether entered two are same or not.
The script will store the information in your database table (tblusers for example). But I still suggest you to read some good books “Build Your Own Database Driven Web Site Using PHP & MySQL, 4th Edition”.

thanks for the code,but this i should make saperate php file,or i should write this same register.php.
pls let me know,dont get angry pls.

reagrds
riyaz.

This code has to be in the same file to which you submit your form


<form action="register.php" method="POST">

If there is something else in the action attribute of form tag then you should place that code in something else.


<form action="signup.php" method="POST">

Then save the code in the signup.php file.