Codeigniter Tutorials
- What is codeigniter?
- Application_Architecture
- MVC Architecture
- HMVC Architecture
- Codeigniter Configuration
- Remove index.php from url in codeigniter
- MVC Concept
- View
- Alternate PHP Syntax for View Files
- Routing
- Codeigniter URL
- Get Current URL
- Previous page URL get
- Seo Friendly URL
- Slug Create in codeigniter
- What is _remap() function
- Remove controller name from url in codeigniter
- Codeigniter Controller Class
- Class Constructor
- GET $ POST method in Codeigniter
- Models
- Basepath, Apppath, FCPATH
- URI Segment
- Page Redirect
- Helper class
- Custom Helper class
- Form Helper
- Common Helper Functions
- Common Function
- Array Problems
- Call controller in Helper
- Add active class to menu using Helper class
- Custom Library
- Custom Library Example
- when to use get_instance()
- Codeigniter Hook
- how to work inline css in codeigniter
- Custom 404 page
- 404 custom error page
- Create custom config file in codeigniter
- How to set and get config item value
- How to Speed Up CodeIgniter App?
- Codeigniter Functions
- Session
- cookies
- How to Set & Get Tempdata in Codeigniter
- flash messages in Codeigniter
- Flashdata
- Encryption and Decryption In CodeIgniter
- Codeigniter security
- csrf token form security
- Password Hashing
- Form Validation
- Custom Validation
- Registration Form with validation
- Server Side Form Validation
- Validate Select Option Field
- Date Format Validation
- Date Format change in codeigniter
- Date Functions
- DOB Validation
- CI CRUD
- User SignUp
- User Login
- User Logout
- Login Account
- Login form with RememberMe
- Login Form with session
- User change password
- Change Password with Callback Validation to Check Old Password
- Forgot password
- Reset password
- Insert data in database
- Fetch data from database
- Update data in database
- Delete data in database
- File Upload
- Image Upload with resize Image
- Upload Multiple file and images
- Upload Multiple images with CRUD
- File and image update
- Upload Image Using Ajax.
- Email Send
- Email Send Using Email library
- Email Send Using SMTP Gmail
- Notification send
- store data in json format in DB
- Json parse
- Fetch data Using Ajax with Json data
- How to Show data Using Ajax with Json parse
- Get JSON Data from PHP Script using jQuery Ajax
- Insert data Using Ajax
- Submit data Using Ajax with form validation
- How to show data Using Ajax in codeigniter
- Insert & Update Using Ajax
- Registration Form With Validation Using Ajax in codeigniter
- Delete data Using Ajax Confirmation
- Delete All data Using checkbox selection
- Ajax CSRF Token
- Ajax Post
- Ajax serverside form validation
- Contact form using AJAX with form validation
- DataTable Using Ajax dynamically
- DataTables pagination using AJAX with Custom filter
- DataTables AJAX Pagination with Search and Sort in codeigniter
- DataTables in Codeigniter using Ajax
- Ajax Custom Serarch
- Ajax Live Data Search using Jquery PHP MySql
- Ajax Custom Serarch and sorting in datatable
- Dynamic Search Using Ajax
- Autocomplete using jquery ajax
- Jquery Ajax Autocomplete Search using Typeahead
- Dynamic Dependent Dropdown Using Ajax
- Dynamic Dependent Dropdown list Using Ajax
- Dynamic Dependent Dropdown in codeigniter using Ajax
- ajax username/email availability check using JQuery
- Check Email Availability Using Ajax
- Data Load on mouse scroll
- Ajax CI Pagination
- Pagination in codeigniter
- Ajax Codeigniter Pagination
- email exists or not using ajax with json
- CRUD using AJAX With Modal popup in CI
- Add / Show Data on modal popup using Ajax
- Modal popup Validation using Ajax
- Data show on Modal popup Using Ajax
- Add / Remove text field dynamically using jquery ajax
- How to Add/Delete Multiple HTML Rows using JavaScript
- Delete Multiple Rows using Checkbox
- Multiple Checkbox value
- Form submit using jquery Example
- REST & SOAP API
- Multi-Language implementation in CodeIgniter
- How to pass multiple array in view
- Captcha
- create zip file and download
- PhpOffice PhpSpreadsheet Library (Export data in excel sheet)
- data export in excel sheet
- Excel File generate in Codeigniter using PHPExcel
- Dompdf library
- tcpdf library
- Html table to Excel & docs download
- CI Database Query
- Database Query
- SQL Injection Prevention
- Auth Model
- Join Mysql
- Tree View in dropdown option list
- OTP Integration in codeigniter
- curl post
- download file using curl
- Sweet Alert
- Sweet alert Delete & Success
- Log Message in Codeigniter
- Menu & Submenu show dynamically
- Set Default value in input box
- Cron Jobs
- Stored Procedure
- Display Loading Image when AJAX call is in Progress
- Send SMS
- IP Address
- Codeigniter Tutorialspoint
- Website Link
- How To Create Dynamic Xml Sitemap In Codeigniter
- Paypal Payment Integration
- Get Latitude and Longitude From Address in Codeigniter Using google map API
- How To Create Simple Bar Chart In Codeigniter Using AmCharts?
- dynamic Highcharts in Codeigniter
- Barcode in Codeigniter
- Codeigniter Interview Questions
- Project
Home » Codeigniter »
How to insert data in database?
controller : insert_ctrl.php
<?php
class insert_ctrl extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('insert_model');
}
function index() {
//Including validation library
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
//Validating Name Field
$this->form_validation->set_rules('dname', 'Username', 'required|min_length[5]|max_length[15]');
//Validating Email Field
$this->form_validation->set_rules('demail', 'Email', 'required|valid_email');
//Validating Mobile no. Field
$this->form_validation->set_rules('dmobile', 'Mobile No.', 'required|regex_match[/^[0-9]{10}$/]');
//Validating Address Field
$this->form_validation->set_rules('daddress', 'Address', 'required|min_length[10]|max_length[50]');
if ($this->form_validation->run() == FALSE) {
$this->load->view('insert_view');
} else {
//Setting values for tabel columns
$data = array(
'Student_Name' => $this->input->post('dname'),
'Student_Email' => $this->input->post('demail'),
'Student_Mobile' => $this->input->post('dmobile'),
'Student_Address' => $this->input->post('daddress')
);
//Transfering data to Model
$this->insert_model->form_insert($data);
$data['message'] = 'Data Inserted Successfully';
//Loading View
$this->load->view('insert_view', $data);
}
}
}
?>
MODEL : insert_model.php
<?php
class insert_model extends CI_Model{
function __construct() {
parent::__construct();
}
function form_insert($data){
// Inserting in Table(students) of Database(college)
$this->db->insert('students', $data);
}
}
?>
My SQL Code Segment
File name : index.php
:
To create database and table, execute following codes in your My SQL .
CREATE DATABASE college;
CREATE TABLE students(
Student_id int(10) NOT NULL AUTO_INCREMENT,
Student_Name varchar(255) NOT NULL,
Student_Email varchar(255) NOT NULL,
Student_Mobile varchar(255) NOT NULL,
Student_Address varchar(255) NOT NULL,
PRIMARY KEY (Student_id)
)
VIEW FILE: insert_view.php
<html>
<head>
<title>Insert Data Into Database Using CodeIgniter Form</title>
<link href='http://fonts.googleapis.com/css?family=Marcellus' rel='stylesheet' type='text/css'/>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/style.css" />
</head>
<body>
<div id="container">
<?php echo form_open('insert_ctrl'); ?>
<h1>Insert Data Into Database Using CodeIgniter</h1><hr/>
<?php if (isset($message)) { ?>
<CENTER><h3 style="color:green;">Data inserted successfully</h3></CENTER><br>
<?php } ?>
<?php echo form_label('Student Name :'); ?> <?php echo form_error('dname'); ?><br />
<?php echo form_input(array('id' => 'dname', 'name' => 'dname')); ?><br />
<?php echo form_label('Student Email :'); ?> <?php echo form_error('demail'); ?><br />
<?php echo form_input(array('id' => 'demail', 'name' => 'demail')); ?><br />
<?php echo form_label('Student Mobile No. :'); ?> <?php echo form_error('dmobile'); ?><br />
<?php echo form_input(array('id' => 'dmobile', 'name' => 'dmobile', 'placeholder' => '10 Digit Mobile No.')); ?><br />
<?php echo form_label('Student Address :'); ?> <?php echo form_error('daddress'); ?><br />
<?php echo form_input(array('id' => 'daddress', 'name' => 'daddress')); ?><br />
<?php echo form_submit(array('id' => 'submit', 'value' => 'Submit')); ?>
<?php echo form_close(); ?><br/>
<div id="fugo">
</div>
</div>
</body>
</html>
CSS FILE: styles.css
#container {
width:960px;
height:610px;
margin:50px auto
}
.error {
color:red;
font-size:13px;
margin-bottom:-15px
}
form {
width:345px;
padding:0 50px 20px;
background:linear-gradient(#fff,#FF94BB);
border:1px solid #ccc;
box-shadow:0 0 5px;
font-family:'Marcellus',serif;
float:left;
margin-top:10px
}
h1 {
text-align:center;
font-size:28px
}
hr {
border:0;
border-bottom:1.5px solid #ccc;
margin-top:-10px;
margin-bottom:30px
}
label {
font-size:17px
}
input {
width:100%;
padding:10px;
margin:6px 0 20px;
border:none;
box-shadow:0 0 5px
}
input#submit {
margin-top:20px;
font-size:18px;
background:linear-gradient(#22abe9 5%,#36caf0 100%);
border:1px solid #0F799E;
color:#fff;
font-weight:700;
cursor:pointer;
text-shadow:0 1px 0 #13506D
}
input#submit:hover {
background:linear-gradient(#36caf0 5%,#22abe9 100%)
}
Insert Data :-
public function addemployeedata()
{
$firstname = $this->input->post('fname');
$lastname = $this->input->post('lname');
$post_data = array(
'First_name'=> $firstname,
'Last_name'=>$lastname
// here First_name is table column name.
);
$this->db->insert('emp_details',$post_data);
// emp_details is table name.
//return $this->db->insert_id();
//$resp=$this->db->insert('emp_details',$post_data);
//echo "<script>alert('$resp')</script>";
redirect('AddEmployee');
}
Insert Data :-
function user_insert(){
if (isset($_POST['submit'])){
$data = array('name'=>$_POST['name'],
'class'=>$_POST['class']);
$this->Auth_model->insert($data);
}
}
Auth_model.php
function insert($data)
{
$this->db->insert('table_name',$data);
return true;
}
Insert Data :-
public function addemployeedata()
{
if($this->input->post('submit') == 'Submit')
{
$data = array(
'name' => $this->input->post('fname'),
'address' => $this->input->post('lname')
);
$this->Auth_model->add_employee($data);
redirect('AddEmployee');
}
else {
$this->load->view('addemployee');
}
}
Auth_model.php
public function add_employee($data)
{
$this->db->insert('emp_details', $data);
return;
}
Insert Data :-
class AddEmployee extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->view('addemployee_view');
}
public function addemployeedata()
{
$this->form_validation->set_rules("eid", "User name", "trim|required");
$this->form_validation->set_rules('doj', 'Date Of Joining', 'required|trim');
$this->form_validation->set_rules("fname", "First Name", "trim|required");
$this->form_validation->set_rules('lname', 'Last Name', 'required|trim');
$this->form_validation->set_rules("uid", "User Id", "trim|required");
$this->form_validation->set_rules('pass', 'Password', 'required|trim|min_length[5]|max_length[20]');
$this->form_validation->set_rules("desig", "Designation", "trim|required");
$this->form_validation->set_rules('dob', 'Date Of Birth', 'required|trim');
$this->form_validation->set_rules("gender", "Gender", "trim|required");
$this->form_validation->set_rules('tadd', 'Temporary Address', 'required|trim');
$this->form_validation->set_rules("padd", "Permanent Address", "trim|required");
$this->form_validation->set_rules('qualification', 'Qualification', 'required|trim');
$this->form_validation->set_rules('email', 'Email', 'required|trim');
$this->form_validation->set_rules('mob', 'Mobile No', 'required|trim|min_length[10]|max_length[12]');
if ($this->form_validation->run() == FALSE)
{
//validation fails
$this->load->view('addemployee_view');
}
else
{
if($this->input->post('submit') == "Submit")
{
$data = array(
'employee_id' => $this->input->post('eid'),
'date_of_joining' => $this->input->post('doj'),
'first_name' => $this->input->post('fname'),
'last_name' => $this->input->post('lname'),
'user_id' => $this->input->post('uid'),
'password' => $this->input->post('pass'),
'designation' => $this->input->post('desig'),
'date_of_birth' => $this->input->post('dob'),
'gender' => $this->input->post('gender'),
'temp_address' => $this->input->post('tadd'),
'perm_address' => $this->input->post('padd'),
'qualification' => $this->input->post('qualification'),
'email' => $this->input->post('email'),
'mobile_no' => $this->input->post('mob')
);
$this->Auth_model->user_add($data);
$this->session->set_flashdata('msg', 'successfully inserted');
redirect('AddEmployee');
}
}
}
}
Auth_model.php
public function user_add($data)
{
$this->db->insert('emp_details', $data);
return;
}
addemployee_view.php :-
<div class="page-content-wrap">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<center><div style="color:red;"><?php //echo validation_errors(); ?></div></center>
<h3 class='flashMsg flashSuccess' style="color:green;"> <?=$this->session->flashdata('msg')?> </h3>
<form class="form-horizontal" action="<?php echo base_url('AddEmployee/addemployeedata');?>" method="post" name="frm">
<div class="col-md-6">
<div class="form-group">
<label class="col-md-3 control-label">Employee Id</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-pencil"></span></span>
<input type="text" class="form-control" name="eid"/>
</div>
<span class="help-block" style="color:red;"><?php echo form_error('eid'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">First Name</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-pencil"></span></span>
<input type="text" class="form-control" name="fname"/>
</div>
<span class="help-block" style="color:red;"><?php echo form_error('fname'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Last Name</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-pencil"></span></span>
<input type="text" class="form-control" name="lname"/>
</div>
<span class="help-block" style="color:red;"><?php echo form_error('lname'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">User Id</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-pencil"></span></span>
<input type="text" class="form-control" name="uid"/>
</div>
<span class="help-block" style="color:red;"><?php echo form_error('uid'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Password</label>
<div class="col-md-9 col-xs-12">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-unlock-alt"></span></span>
<input type="password" class="form-control" name="pass"/>
</div>
<span class="help-block" style="color:red;"><?php echo form_error('pass'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Designation</label>
<div class="col-md-9">
<select class="form-control select" name="desig">
<option value="">--- Select ---</option>
<option value="php developer">Php Developer</option>
<option value="wordpress developer">wordpress Developer</option>
<option value="fullstack developer">Fullstack Developer</option>
<option value="android develoer">Android Developer</option>
<option value="graphics developer">Graphics Designer</option>
<option value="content writer">Content Writer</option>
<option value="data entry operator">Data Entry Operator</option>
<option value="telecaller">Tele Caller</option>
<option value="hr">Hr</option>
<option value="officeboy">Office Boy</option>
</select>
<span class="help-block" style="color:red;"><?php echo form_error('desig'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Temporary Address</label>
<div class="col-md-9 col-xs-12">
<textarea class="form-control" rows="6" name="tadd"></textarea>
<span class="help-block" style="color:red;"><?php echo form_error('tadd'); ?></span>
</div>
</div>
<!--
<div class="form-group">
<label class="col-md-3 control-label">Profile Picture</label>
<div class="col-md-9">
<input type="file" class="fileinput btn-primary" name="filename" id="filename" title="Browse file"/>
</div>
</div>
-->
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-md-3 control-label">Date Of Joining</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-calendar"></span></span>
<input type="text" class="form-control datepicker" name="doj">
</div>
<span class="help-block" style="color:red;"><?php echo form_error('doj'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Email</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-pencil"></span></span>
<input type="text" class="form-control" name="email"/>
</div>
<span class="help-block" style="color:red;"><?php echo form_error('email'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Mobile No</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-pencil"></span></span>
<input type="text" class="form-control" name="mob"/>
</div>
<span class="help-block" style="color:red;"><?php echo form_error('mob'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Date Of Birth</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-calendar"></span></span>
<input type="text" class="form-control datepicker" name="dob">
</div>
<span class="help-block" style="color:red;"><?php echo form_error('dob'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Gender</label>
<div class="col-md-9">
<div class="input-group">
<input type="radio" class="" name="gender" value="male"> Male
<input type="radio" class="" name="gender" value="female"> FeMale
</div>
<span class="help-block" style="color:red;"><?php echo form_error('gender'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Qualification</label>
<div class="col-md-9">
<select class="form-control select" name="qualification">
<option value="">--- Select ---</option>
<option value="Diploma">Diploma</option>
<option value="BTech">BTech</option>
<option value="MTech">MTech</option>
<option value="BCA">BCA</option>
<option value="MCA">MCA</option>
<option value="Bsc IT">Bsc IT</option>
<option value="Msc IT">Msc IT</option>
<option value="Others">Others</option>
</select>
<span class="help-block" style="color:red;"><?php echo form_error('qualification'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Permanent Address</label>
<div class="col-md-9 col-xs-12">
<textarea class="form-control" rows="6" name="padd"></textarea>
<span class="help-block" style="color:red;"><?php echo form_error('padd'); ?></span>
</div>
</div>
</div>
<div class="panel-footer">
<!-- <button class="btn btn-default">Clear Form</button> -->
<!-- <button class="btn btn-primary pull-right" name="submit" >Submit</button>-->
<br/>
<center><input type="submit" name="submit" value="Submit" /></center>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
Example :-
SQL Query
CREATE TABLE crud (
`id` int(11) NOT NULL,
`first_name` varchar(30) NOT NULL,
`last_name` varchar(30) NOT NULL,
`email` varchar(30) NOT NULL,
PRIMARY KEY (id)
);
Crud.php (Controller) :-
<?php
class Crud extends CI_Controller
{
public function __construct()
{
//call CodeIgniter's default Constructor
parent::__construct();
//load database libray manually
$this->load->database();
//load Model
$this->load->model('Auth_model');
}
//Insert
public function savedata()
{
//load registration view form
$this->load->view('insert');
//Check submit button
if($this->input->post('save'))
{
$first_name=$this->input->post('first_name');
$last_name=$this->input->post('last_name');
$email=$this->input->post('email');
$this->Auth_model->saverecords($first_name,$last_name,$email);
echo "Records Saved Successfully";
}
}
}
?>
Auth_model :-
<?php
class Auth_model extends CI_Model
{
//Insert
function saverecords($first_name,$last_name,$email)
{
$query="insert into crud values('','$first_name','$last_name','$email')";
$this->db->query($query);
}
}
insert.php (View) :-
<!DOCTYPE html>
<html>
<head>
<title>Registration form</title>
</head>
<body>
<form method="post">
<table width="600" border="1" cellspacing="5" cellpadding="5">
<tr>
<td width="230">First Name </td>
<td width="329"><input type="text" name="first_name"/></td>
</tr>
<tr>
<td>Last Name </td>
<td><input type="text" name="last_name"/></td>
</tr>
<tr>
<td>Email ID </td>
<td><input type="email" name="email"/></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="save" value="Save Data"/></td>
</tr>
</table>
</form>
</body>
</html>
Insert data in database.
File name : Controller.php
<?php
class Controller extends CI_Controller
{
public function __construct()
{
//call CodeIgniter's default Constructor
parent::__construct();
//load database libray manually
$this->load->database();
//load Model
$this->load->model('Auth_Model');
}
public function savedata()
{
//load registration view form
$this->load->view('registration');
//Check submit button
if($this->input->post('save'))
{
//get form's data and store in local varable
$n=$this->input->post('name');
$e=$this->input->post('email');
$m=$this->input->post('mobile');
//call saverecords method of Auth_Model and pass variables as parameter
$this->Auth_Model->saverecords($n,$e,$m);
echo "Records Saved Successfully";
}
}
}
?>
Model
File name : Auth_model.php
<?php
class Auth_Model extends CI_Model
{
function saverecords($name,$email,$mobile)
{
$query="insert into users values('','$name','$email','$mobile')";
$this->db->query($query);
}
}
View
File name : registration.php
<!DOCTYPE html>
<html>
<head>
<title>Registration form</title>
</head>
<body>
<form method="post">
<table width="600" border="1" cellspacing="5" cellpadding="5">
<tr>
<td width="230">Enter Your Name </td>
<td width="329"><input type="text" name="name"/></td>
</tr>
<tr>
<td>Enter Your Email </td>
<td><input type="text" name="email"/></td>
</tr>
<tr>
<td>Enter Your Mobile </td>
<td><input type="text" name="mobile"/></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="save" value="Save Data"/></td>
</tr>
</table>
</form>
</body>
</html>
Simple Registration Form
File name : Controller.php
<?php
class Controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
if($this->input->post('register'))
{
$n=$this->input->post('name');
$e=$this->input->post('email');
$p=$this->input->post('pass');
$m=$this->input->post('mobile');
$c=$this->input->post('course');
$que=$this->db->query("select * from student where email='".$e."'");
$row = $que->num_rows();
if($row)
{
$data['error']="<h3 style='color:red'>This user already exists</h3>";
}
else
{
$que=$this->db->query("insert into student values('','$n','$e','$p','$m','$c')");
$data['error']="<h3 style='color:blue'>Your account created successfully</h3>";
}
}
$this->load->view('student_registration',@$data);
}
}
?>
View
File name : student_registration.php
<!DOCTYPE html>
<html>
<head>
<title>Student Registration form</title>
</head>
<body>
<form method="post">
<table width="600" align="center" border="1" cellspacing="5" cellpadding="5">
<tr>
<td colspan="2"><?php echo @$error; ?></td>
</tr>
<tr>
<td width="230">Enter Your Name </td>
<td width="329"><input type="text" name="name"/></td>
</tr>
<tr>
<td>Enter Your Email </td>
<td><input type="text" name="email"/></td>
</tr>
<tr>
<td>Enter Your Password </td>
<td><input type="password" name="pass"/></td>
</tr>
<tr>
<td>Enter Your Mobile </td>
<td><input type="text" name="mobile"/></td>
</tr>
<tr>
<td>Select Your Course </td>
<td>
<select name="course">
<option value="">Select Course</option>
<option>PHP</option>
<option>Java</option>
<option>Wordpress</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" name="register" value="Register Me"/></td>
</tr>
</table>
</form>
</body>
</html>
File name : registration.php