Make this Function into your Controller and call this function on to your Viewpage.
function send_password()
{
$this->db->where('email',$this->input->post('email'));
$query1 = $this->db->get('tablename from database');
if($query1 ->num_rows() > 0)
{
foreach ($query1->result() as $rows)
{
$name = $rows->firstname;
$password = $rows->password;
$subject= $name.", Your Password was successfully delivered on your email";
$message="";
$message ='<p >Hi '.$name.',<br/><br/>
You have Successfully Retrieve your password. <br/>
Your Password is : '.$password.' </p> ';
$to=$rows->email;
$headers = "From: ".$_SERVER['HTTP_HOST']."\r\n";
$headers .= "Content-type: text/html\r\n";
if(mail($to,$subject,$message,$headers))
{
echo "<script>
alert('Please Check Ur Mail Account... Your Password was Successfully delievered on your mail..');
window.location='".base_url()."index.php/controller/';
</script>";
}
}
}
else{
echo "<script>
alert('Your Email is not in our database..');
window.location='".base_url()."index.php/controller/';
</script>"; }
}
function send_password()
{
$this->db->where('email',$this->input->post('email'));
$query1 = $this->db->get('tablename from database');
if($query1 ->num_rows() > 0)
{
foreach ($query1->result() as $rows)
{
$name = $rows->firstname;
$password = $rows->password;
$subject= $name.", Your Password was successfully delivered on your email";
$message="";
$message ='<p >Hi '.$name.',<br/><br/>
You have Successfully Retrieve your password. <br/>
Your Password is : '.$password.' </p> ';
$to=$rows->email;
$headers = "From: ".$_SERVER['HTTP_HOST']."\r\n";
$headers .= "Content-type: text/html\r\n";
if(mail($to,$subject,$message,$headers))
{
echo "<script>
alert('Please Check Ur Mail Account... Your Password was Successfully delievered on your mail..');
window.location='".base_url()."index.php/controller/';
</script>";
}
}
}
else{
echo "<script>
alert('Your Email is not in our database..');
window.location='".base_url()."index.php/controller/';
</script>"; }
}
0 comments:
Post a Comment