Trying to get property 'nim' of non-object

hi there!
saya punya masalah di sini

<form role="form" class="form-horizontal"  action="<?php echo 'cnp_controller/prosesEdit'; ?>" method="post" enctype="multipart/form-data">
	<!-- <div class="conatiner"> -->
	<div class="card o-hidden border-0 shadow-lg my-5 col-lg-4 mx-auto">
		<div class="form-group">
			<label for="NIM">NIM</label>
			<input type="text" class="form-control" id="nim" name="nim" value=<?php echo $mahasiswa->nim; ?>>
			<input type="hidden" class="form-control" name="nim_lama" id=nim_lama>
		</div>
		<div class="form-group">
			<label for="Nama">Nama</label>
			<input type="text" class="form-control" id="nama" name="nama" value=<?php echo $mahasiswa->nama; ?>>
			<?php echo form_error('nama', '<div style="color:red">', '</div>'); ?>
		</div>
		<div class="form-group">
			<label for="tempat">Tempat Lahir</label>
			<input type="text" class="form-control" id="tempat" name="tempat" value=<?php echo $mahasiswa->tempat_lahir; ?>>
		</div>
		<div class="form-group">
			<label for="tgl">Tanggal Lahir (YYYY/mm/dd)</label>
			<input type="text" class="form-control" id="tgl" name="tgl" value=<?php echo $mahasiswa->tanggal_lahir; ?>>
		</div>
		<div class="form-group">
			<label for="alamat">Alamat</label>
			<input type="text" class="form-control" id="alamat" name="alamat" value=<?php echo $mahasiswa->alamat; ?>>
		</div>
		<div>
			<label for="jk">Jenis Kelamin</label>
			<div class="form-check">
				<input class="form-check-input" type="radio" name="jk" id="jk" value="Pria">
				<label class="form-check-label" for="jk">
					Pria
				</label>
			</div>
			<div class="form-check">
				<input class="form-check-input" type="radio" name="jk" id="jk" value="Wanita">
				<label class="form-check-label" for="jk">
					Wanita
				</label>
			</div>
		</div>
		<div class="form-row align-items-center">
			<label for="jurusan">Jurusan</label>
			<div class="col-auto my-1">
				<select class="custom-select mr-sm-2" id="jurusan" name="jurusan">
					<option selected>Choose...</option>
					<option value="Administrasi Bisnis">Administrasi Bisnis</option>
					<option value="Komputerisasi Akuntansi">Komputerisasi Akuntansi</option>
					<option value="Manajemen Informatika">Manajemen Informatika</option>
					<option value="Hubungan Masyarakat">Hubungan Masyarakat</option>
				</select>
			</div>
		</div>
		<div class="form-row align-items-center">
			<label for="angkatan">Angkatan</label>
			<div class="col-auto my-1">
				<select class="custom-select mr-sm-2" id="angkatan" name="angkatan">
					<option selected>Choose...</option>
					<option value="2017">2017</option>
					<option value="2018">2018</option>
					<option value="2019">2019</option>
					<option value="2020">2020</option>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label for="no_hp">No HP</label>
			<input type="text" class="form-control" id="no_hp" name="no_hp" value=<?php echo $mahasiswa->no_hp; ?>>
		</div>
		<div class="form-group">
			<label for="no_hp_ortu">No HP Orang Tua</label>
			<input type="text" class="form-control" id="no_hp_ortu" name="no_hp_ortu" value=<?php echo $mahasiswa->no_hp_ortu; ?>>
		</div>
		<div class="form-group">
			<label for="foto">Foto</label>
			<input type="file" class="form-control-file" id="foto" name="foto">
		</div>
		<button type="submit" class="btn btn-warning btn-sm my-3 col-lg-3 mx-auto">Update</button>
	</div>
	<!-- </div> -->
	</form>
public function prosesEdit()
	{
			$foto = $_FILES['foto'];
			if ($foto = '') {
			} else {
				$konfigurasi['upload_path'] = './upload';
				$konfigurasi['allowed_types'] = 'gif|jpg|png|jpeg';
				$konfigurasi['max_size'] = '5048';
				$konfigurasi['max_height'] = '1920';
				$konfigurasi['max_width'] = '1920';

				$this->load->library('upload');
				$this->upload->initialize($konfigurasi);
				if (!$this->upload->do_upload('foto')) {
					echo $this->upload->display_errors();
					die();
				} else {
					$foto = $this->upload->data('file_name');
				}
			}
			$this->form_validation->set_rules('nim', 'NIM', 'required|is_unique[mahasiswa.nim]', ['is_unique' => 'The NIM has already registered']);
			$this->form_validation->set_rules('nama', 'Nama', 'required');

			$data['nim'] = $this->input->post('nim');
			$data['nama'] = $this->input->post('nama');
			$nim_lama = $this->input->post('nim_lama');
			$data['tempat_lahir'] = $this->input->post('tempat');
			$data['tanggal_lahir'] = $this->input->post('tgl');
			$data['alamat'] = $this->input->post('alamat');
			$data['jenis_kelamin'] = $this->input->post('jk');
			$data['jurusan'] = $this->input->post('jurusan');
			$data['angkatan'] = $this->input->post('angkatan');
			$data['no_hp'] = $this->input->post('no_hp');
			$data['no_hp_ortu'] = $this->input->post('no_hp_ortu');
			$data['foto'] = $foto;

			var_dump($data);
			$this->cnp_model->editMahasiswa($nim_lama, $data);
			$this->session->set_flashdata('message', 'Update Record Success');
			redirect(site_url('cnp_controller/mahasiswa'));
}

masalahnya selalu muncul message
[Trying to get property ‘nim’ of non-object]

A PHP Error was encountered
Severity: Notice

Message: Trying to get property 'nim' of non-object

Filename: views/edit_mahasiswa.php

Line Number: 55

Backtrace:

File: C:\xampp\htdocs\belajarCI\application\views\edit_mahasiswa.php
Line: 55
Function: _error_handler

File: C:\xampp\htdocs\belajarCI\application\controllers\cnp_controller.php
Line: 102
Function: view

line 55 itu yang ini di edit_mahasiswa

<input type="text" class="form-control" id="nim" name="nim" value=<?php echo $mahasiswa->nim; ?>>

line 102 di cnp_controller

$this->load->view('edit_mahasiswa', $data);