[eluser]Zimooon[/eluser]
Hey guys,
following problem:
In my Edit Function for my Blog i got following View:
Code:
<?php
$this->db->select('*');
$this->db->where('id', $this->uri->segment(3));
$query = $this->db->get('posts');
foreach ($query->result() as $row)
{
$title = $row->title;
$date = $row->date;
$content = $row->content;
$image = $row->image;
$foldername = $row->foldername;
$active = $row->active;
}
?>
<?php $attributes = array('name' => 'createnews');?>
<?php echo form_open('crud/update/'.$this->uri->segment(3) , $attributes ); ?>
<div style="margin:0 0 20px 0; color:red"> <?php echo validation_errors(); ?></div>
<fieldset>
<label for="title">Titel:</label>
<input type="text" id="title" name="title" value="<?php echo $title ?>" class="inputText" />
</fieldset>
<fieldset>
<label for="date">Datum:</label>
<input type="text" id="date" name="date" value="<?php echo unix_to_date($date)?>" class="inputText" />
</fieldset>
<fieldset>
<label for="content">Inhalt:</label>
<textarea rows="15" cols="80" style="width: 30%" type="text" class="tinymce" name="content" class="inputContent"><?php echo $content ?></textarea>
</fieldset>
Now when i got validation errors it sets everything back to the data from database.
For the validation i use
Code:
<?php echo set_value('title')?>
But how can i tell him to use this when throwing errors.
Use other view ? or is there anything hmm more logical.
best regards