I know similiar questions have been asked, but I've still been unable to resolve my issue. When my view loads, I get the error below, and I know there is a value in $id.
Message: Undefined variable: id Filename: admin/upload_form.php Line Number: 17
Controller:
public function getEventNameById( $id ) {
$q = $this->event_model->getEventNameById( $id );
echo "Event Name: ".$q."</p>";
$data['id'] = $id;
$this->load->view('admin/upload_form',array('error' => ' ' ), $data);
}
View:
<body>
<div>
<?php echo $error;?>
<p>Event Image:</p>
<?php echo form_open_multipart('admin_upload/do_upload');?>
<input type="file" name="userfile" size="20" />
<br /><br />
<input type="hidden" id="iEventID" name="iEventID" value="<?php echo $id;?>" />
<input type="submit" value="upload event image" /> <input type="button" value="close"
onclick="window.close()">
</form>
</div>
</body>
What I need to be able to do, is query information based on an ID, then pass that ID to my view, which will then pass the ID back to a different controller function for use in updating a record in my database. In other words I need to persist the ID throughout.
Any and all assistance is greatly appreciated.