How to register User ?

User SignUp

<?php
class User extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->helper('url');
}
public function sign_up()
{
if($this->input->post('save'))
{
$name=$this->input->post('name');
$email=$this->input->post('email');
$password=$this->input->post('pass');
$phone=$this->input->post('phone');
$que=$this->db->query("select * from user_login where email='$email'");
$row = $que->num_rows();
if(count($row)>0)
{
$data['error']="<h3 style='color:red'>Email id already exists</h3>";
}
else
{
$que=$this->db->query("insert into user_login values('','$name','$email','$phone','$password')");
$data['error']="<h3 style='color:blue'>Your account created successfully</h3>";
}
}
$this->load->view('student_registration',@$data);
}
}
?>

student_registration.php

<!DOCTYPE html>
<html>
<head>
<title>Student Signup 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 Mobile </td>
<td><input type="text" name="phone"/></td>
</tr>
<tr>
<td>Enter Your Password </td>
<td><input type="password" name="pass"/></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" name="save" value="Register Me"/></td>
</tr>
</table>
</form>
</body>
</html>





Previous Next


Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here