In
this tutorial, I will explain that how to create a simple registration
form in PHP and mysql. Registration form is necessary for all online
activities for small website to a big web portal. Registration means
providing necessary information to the website for further activities.
The website will store all the information into their database and when
you will again visit that website you just need to login no need to
provide detail again.
So the registration form has important role in present website.
Here, we are using javascript validations for input fields. So user can learn different type of validation in javascript like simple text field, email ID etc.
Now we will see how to create Registration Form in PHP and Mysql step by step.
Steps are given below:
There are four files for Registration Form:
Here just change the above value like Host name, database user name, database password and database name.
The register.php file looks like this:
The registerAction.php file looks like this:
That’s all about Registration Form.
See more at: Click Here
So the registration form has important role in present website.
Here, we are using javascript validations for input fields. So user can learn different type of validation in javascript like simple text field, email ID etc.
Now we will see how to create Registration Form in PHP and Mysql step by step.
Steps are given below:
There are four files for Registration Form:
- dbConfig.php
- register.php
- registerAction.php
- validate.js
1
2
3
4
5
6
7
8
9
| <!--?phpdefine ("DB_HOST", "localhost"); // set database hostdefine ("DB_USER", ""); // set database userdefine ("DB_PASS",""); // set database passworddefine ("DB_NAME",""); // set database name$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection.");$db = mysql_select_db(DB_NAME, $link) or die("Couldn't select database");?--> |
The register.php file looks like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| <form action="registerAction.php" method="post" name="frmregister"><table class="form" border="0"> <tbody> <tr> <th><strong>Name:</strong></th> <td><input name="name" size="30" type="text"></td> </tr> <tr> <th><strong>Nick Name:</strong></th> <td><input name="nick_name" size="30" type="text"></td> </tr> <tr> <th><strong>Email:</strong></th> <td><input name="email" size="30" type="text"></td> </tr> <tr> <th><strong>Password:</strong></th> <td><input name="password" size="30" type="password"></td> </tr> <tr> <td> </td> <td><input alt="Submit" value="Submit" type="submit"> <input alt="Reset" value="Reset" type="reset"></td> </tr> </tbody></table></form> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| <!--?phpinclude "dbConfig.php";if($_POST[ 'name' ]!="") {$name = mysql_real_escape_string($_POST["name"]);$nick_name = mysql_real_escape_string($_POST["nick_name"]);$email = mysql_real_escape_string($_POST["email"]);$password = mysql_real_escape_string($_POST["password"]);$sql = "insert into members set name='".$name."', nick_name='".$nick_name."', email='".$email."', password='".md5($password)."' ";$sql = mysql_query($sql);$msg = '<p class = "tanx"-->Thank you for completing your online registration form!.';}else{$msg = "Your enquiry sending failed";} ?> |
See more at: Click Here
No comments:
Post a Comment