You can try this
$tablename = $_POST['tblname'];
$mastertable = $_POST['mastertable']
$this->db->query("CREATE TABLE $tablename LIKE $mastertable");
To copy data
$query = $this->db->get($mastertable);
foreach ($query->result() as $row) {
$this->db->insert($tablename,$row);
}