Building a Member Registration Application form In PHP

Building a Member Registration Application Form In PHP Here, we will create a simple registration form in PHP and mysql.

Registration form is created for all online small website to a big websites. Registration means providing necessary information to the website for further activities. The website will store all the information into their database and when a user will again visit that website then they just need to login and no need to provide the details again.

To create Registration Form in PHP and Mysql a user need to follow certain steps.

A user needs to create four files for Registration Form:

  • dbConfig.php
  • register.php
  • registerAction.php

Here, first we will create the dbConfig.php file

define (“DB_HOST”, “localhost”); // set database host
define (“DB_USER”, “”); // set database user
define (“DB_PASS”,””); // set database password
define (“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”);

Here just change the above value like Host name, database user name, database password and database name.

Secondly create the register.php file

<form action=”registerAction.php” method=”post” name=”frmregister”>
<table border=”0″ class=”form”>
<td><input name=”name” size=”30″ type=”text”></td>
<th><strong>Nick Name:</strong></th>
<td><input name=”nick_name” size=”30″ type=”text”></td>
<td><input name=”email” size=”30″ type=”text”></td>
<td><input name=”password” size=”30″ type=”password”></td>
<td> </td>
<td><input alt=”Submit” type=”submit” value=”Submit”> <input alt=”Reset” type=”reset” value=”Reset”></td>

Thirdly we will create the registerAction.php file

include “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!.’;
$msg = “Your enquiry sending failed”;

Scroll to Top