[eluser]fuji2009[/eluser]
my view :
Code:
<div id="ploran" title="i">
<?php echo form_open('profile/pre_loran/'.$user_id,'name="loran"');?>
<table width="400px">
<tr>
<td><?php if ($photos == false): ?>
<img width="65px" height="65px;" src="../../../users/Default/Hfdrtgrdegdf1.gif"/>
<?php else: ?>
<img width="65px" height="65px;"src="<?php echo $photos[0]['thumbs'];?>"/>
<?php endif;?>
</td>
</tr>
<tr>
<td><input type="text" name="info" id="info" size="20" value="" /></td>
<input type="hidden" name="user_login_id" value="<?php echo $user_login_id;?>">
<input type="hidden" name="user_id" value="<?php echo $user_id;?>">
<input type="hidden" name="photos" value="<?php echo $photos[0]['thumbs'];?>">
</tr>
<tr><td><?php echo form_error('info','<div class="error">','</div>');?></td></tr>
<tr>
<td><?php echo form_submit('valid_loran','Valider');?></td>
</tr>
<?php echo form_close();?>
</table>
</div>
and my controller
Code:
function pre_loran($user_id){
$data['page'] = 'person_error';
$data['title'] = 'Erreur';
$data['username'] = $this->session->userdata('username');
$data['user_id'] = '';
$data['user2_id'] = '';
$this->load->model('profile_model');
$this->form_validation->set_rules('info','Info','callback_check_infos|trim|required|valid_email|xss_clean');
if ($this->form_validation->run())
{
$data['page'] = 'person_success';
$data['title'] = 'pre loran';
extract($_POST);
$username = $this->profile_model->get_username_by_id($user_login_id);
$username_profil=$this->profile_model->get_username_by_id($user_id);
$email_profil=$this->profile_model->get_email($user_id);
$this->email->from('[email protected]', 'Presn');
$this->email->to($email_profil);
$this->email->subject('pre_loran');
$this->email->message(''.$username.' <img src="'.$photos.'" />
<a href="#">Click</a>
');
$this->email->send();
$pre_loran = array(
'user1_id' => $user_login_id,
'user2_id' => $user_id,
'user3_id' => '',
'email' => $info,
'type' => 'present',
'valide' => 0,
'created_at' => date('Y-m-d h:i:s',now())
);
$this->profile_model->pre_loran($pre_loran);
$data['demande'] = 'Mee';
}
$data['die']='Already do this action';
$this->load->view('layout/application', $data);
}
function check_infos($str)
{
extract($_POST);
$this->db->select('*');
$this->db->from('meeting');
$this->db->where('email', $str);
$this->db->where('user1_id', $user_login_id);
$this->db->where('user2_id', $user_id);
$query = $this->db->get();
if($query->num_rows() > 0)
{
$this->form_validation->set_message('check_infos', 'Already do');
return false;
}
else
{
return true;
}
}
thanks for your help