Breaking News
yeni film izle hd film seyret film izle

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

<?php
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”>
<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” type=”submit” value=”Submit”> <input alt=”Reset” type=”reset” value=”Reset”></td>
</tr>
</tbody>
</table>
</form>

Thirdly we will create the registerAction.php file

<?php
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!.’;
}else{
$msg = “Your enquiry sending failed”;
}
?>

Check Also

Copying, Renaming, and Deleting Files

PHP also allows you to copy, rename, and delete files. The functions to perform these …