Hi, I’m build a form dinamically in this way:
public function ppi() {
$author_id = $this->uri->segment(3);
$this->data_view['author'] = $this->Mauthor->getOne($author_id);
$this->data_view['ppi_data'] = $ppi_data = $this->Mauthor->getFieldsName('autores_ppi');
$this->load->library('form_validation');
$this->form_validation->set_rules('NIVEL_ING', 'Nivel Ingenieril', 'trim|required');
if ($this->form_validation->run()) {
print_r($_POST);
die();
}
$this->load->view('author/author_ppi', $this->data_view);
}
Then in my view I do this:
<p><strong>Autor NĂºmero:</strong> <?php echo $author->ID_AUTOR ?></p>
<p><strong>Nombres:</strong> <?php echo $author->NOMBRE . ' ' . $author->APELLIDO ?></p>
<?php foreach ($ppi_data as $value): ?>
<?php if ($value != "ID_AUTOR_PPI"): ?>
<p><label><?php echo $value ?></label> <?php echo form_error($value) ?> <input type="text" id="<?php echo $value ?>" name="<?php echo $value ?>" value="<?php echo set_value($value) ?>" class="text-long" /></p>
<?php endif; ?>
<?php endforeach; ?>
$this->uri->segment(3) always takes the author ID passed trough a view. When I show the form for first time all is fine but when I send the form leaving all fields empty I loose the ID from the URL and don’t know why and this cause this message:
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: author/author_ppi.php
Line Number: 9
Nombres:
A PHP Error was encounteredSeverity: Notice
Message: Trying to get property of non-object
Filename: author/author_ppi.php
Line Number: 10
A PHP Error was encounteredSeverity: Notice
Message: Trying to get property of non-object
Filename: author/author_ppi.php
Line Number: 10
What I’m doing wrong?
PS: By the way does any knows a simple CRUD for CI? Not like Grocery and others just the basic CRUD
