Hi all newbie here :) Don't know if this is correct title, so sorry if not...
I'm trying to input data from one table to another for right user
controller:
function Admin(){
$user = $this->input->post('username'); //there is one text field in view page were you input username
$this->user->getEmail($user);
if($this->user->getUser($user)){
$this->user->Input_Admin();
$this->Success();
}
$this->Fail();
}
model:
function Input_Admin(){
$k = array(
'Name' => $this->input->post('username'),
'Email' => $this->input->post('Email'),
);
$a = $this->db->insert('admin', $k);
return $a;
}
function getEmail($user){
$this->db->select('Email');
$this->db->where('username', $user);
$q = $this->db->get('users');
if($q->num_rows > 0){
return $q->result();
}
return FALSE;
}
There is 3 fields in admin table id, name, email... the function for name is working like a charm but for email always input 0.... so what i'm doing wrong?
As req here is view:
<form name="info" method="post" action="<?php echo base_url(); ?>index.php/user_controler/admin">
<table width="500" border="0" cellspacing="1" cellpadding="1" align="center" bgcolor="#FFCC99">
<tr>
<td width="25%">Username:</td>
<td><input type="text" name="username" size="30"></td>
</tr>
<tr>
<td colspan="6">
<div align="center">
<input type="submit" name="Confirm" value="Confirm">
<input type="reset" name="Cancel" value="CANCEL">
</div>
</td>
</tr>
</table>
</form>