gibbo1715 Posted December 13, 2009 Share Posted December 13, 2009 All I was introduced via this forum to a fantastic framework called codeigniter which im assuming a number of you are familiar with I have got everything i want working except for the validation aspect where i need a little help and i ll try and explain how i ve got things set up as best i can I have been playing using arrays to populate my form view data as follows //Set up the table components as I want them viewed here $data['ftitle'] = array('name'=>'title', 'size'=>30 ); $data['fauthor'] = array('name'=>'author', 'size'=>30 ); $data['fpublisher'] = array('name'=>'publisher', 'size'=>30 ); $data['favailable'] = array('name'=>'available', 'value'=>'yes', 'checked'=>TRUE ); $data['fsummary'] = array('name'=>'summary', 'rows'=>5, 'cols'=>60 ); //end books ******************************************* return $data; In in my view page i call this as follows <th><? echo $publisher ?> </th> <!--Validation from my form_validation.php file in the config folder--> <th><? echo form_input($fpublisher).br(); ?> <?php echo form_error('publisher'); ?> </th> and so on..... This all works fine and i can get the form validation working as well but i cant figure out how to not loose my data when the validation fails im aware of the set_value() function but not sure how i would use that as part of my form_input command? Can anyone assist or do i need to go a totally different route thanks gibbo P.S. hope that makes sense if not i ll try and explain a little better Link to comment https://forums.phpfreaks.com/topic/184984-form-validation-in-code-igniter/ Share on other sites More sharing options...
dual_alliance Posted December 13, 2009 Share Posted December 13, 2009 It's quite simply really, you just set it in the array. For example: $data['ftitle'] = array('name'=>'title', 'size' => 30, 'value' => set_value('title') ); $data['fauthor'] = array('name'=>'author', 'size' => 30, 'value' => set_value('author') ); And so on... Link to comment https://forums.phpfreaks.com/topic/184984-form-validation-in-code-igniter/#findComment-976590 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.