Code in controller
public function store_service_provider() {
$get = file_get_contents('php://input');
$json_decode = json_decode($get,true);
foreach ($json_decode as $key => $value) {
$data[$key] = $value;
}
$data['role'] ='provider'; // assign role as provider
$record = $this->serviceprovider_model->store_service_provider($data);
if($record == '2'){
$data['json'] = json_encode(array('flag' => 'false', 'message'=> 'you have account with this email id Thank you '));
$this->load->view('jsonview', $data);
} else {
log_message("info",json_encode($record));
$message['uname'] = '<html><h1>Hi '.$record['first_name']. " " .$record['last_name'].'</h1><br\>
<h2><strong>Welcome to Look My Service.</strong></h2><br/>
<h3>Your Username: '.$record['email'].'</h3><br\>
<h2>To set your password
<a href ="'.base_url().'serviceprovider#/change_password/'.$record['id'].'">Click here </a></h2><br\>
<strong> Thank You </strong></html>';
$this->email->to($data['email']);
$this->email->subject('Hall-book');
$this->email->message(''.$message['uname'].'');
$this->email->message($this->>view('hall_service/email_message',$record,true));
$contact_number = $this->input->post("service_seeker_contact_number");
if(!$this->email->send()) {
$data['json'] = json_encode(array('flag' => 'email_error', 'message'=> ' not correct login '));
$this->load->view('jsonview', $data);
}else{
$message = 'Welcome to Look My Service. Your Username : '.$record['email'].' To set your password check you email Thank you.';
send($data['phone'], $message);
echo json_encode(array('flag' => 'true', 'message'=> 'correct login '));
}
}
}
enter code here
<html>
<head>
<title></title>
</head>
<body>
<h1>sudarshan</h1>
<?php foreach($record as $record):?>
<span><?php echo $record; ?></span><br>
<h1>Hi <?=$record->first_name?> " " <?=$record['last_name']?></h1><br/>
<h2><strong>Welcome to Look My Service.</strong></h2><br/>
<h3>Your Username: <?=$record->email?></h3><br/>
<h2>To set your password
<a href ="base_url()serviceprovider#/change_password/<?=$records['id']?>">Click here </a></h2><br/>
<?php endforeach;?>
<strong> Thank You </strong>
</body>
</html>
Am passing a $record to a view,in controller i can fetch all the values but in i can't fetch the values of $record,How to resolve this problem?How can i disable a link once it is clicked
@aruna angadi
Always remember when you pass any data in variable to view in controller file then you can't get same name variable name in the view file.
You have to go just one step down to get the data.
Example:-
if you want to pass
$data = array();
$data['record'] = $my_record_data;
$this->load->view('view_file_name',$data);
then you will get data with $record variable.
and you can use like this
$record
in your view file.
thanks