Hi guys,
Fairly new with CodeIgniter - hence the simple question (simple for most of you). Would appreciate it very much if you guys could give me some help.
I have a controller for my Dashboard. The index() of the Dashboard includes my header, footer, sidebar, and a general div for some static text. Also included is a ‘wall’ view.
The view is:
<h1>Wall Posts</h1>
Posts below have been made by your family:
<?=form_open('wall/create')?>
<?=form_error('message')?>
<textarea name="message" rows="8" cols="40"><?=set_value('message');?></textarea><br >
<input type="submit" name="submit" value="Post it" id="submit" />
<?=form_close()?>
<?php if ($recent_wall_posts->num_rows() > 0) { ?>
<?php foreach($recent_wall_posts->result() as $p) {?>
<strong>
<a >member_id?>"><?=$p->member_forename?> <?=$p->member_surname?></a>
</strong>
<?=$p->wallPost_message?>
Posted <?=relative_time($p->wallPost_posted_on);?>
<?php } ?>
<? } else { ?>
<strong>No wall posts to display</strong>
<? } ?>As you can see it posts to wall/create - Controller/Function.
The create function checks for validation and if it passes validation it will insert the form data into the Database.
How, if there is an error, it takes me to wall/create and shows the error. I would like it to remain at /dashboard controller only and not forward to wall/create.
What’s the best way to doing a form, I’m thinking perhaps have another function that uses the result of ‘create’ to do something.
Could someone help me out here?
Thank you very much,
Jamie