Filed under: Code Igniter
Code igniter 1.7 version is really make programmer’s life more easier. Save a lot of time and made more tricky validation stuffs. moreover, control all validation of entire site from a single page.
The real power of this version is validation. How? By an example you have 30 forms in your e-commerce site and you add one field to feedback form. You not need to write a single line of code in your controller and model. Impossible? Not at all if you formerly write your model in a good manner. Which mean if you named all fields same(database table field name and html control name). So what you need is only add one field in your form_validation.php file and add additional field in your view file. that’s it.
Lets draw an example You want to add visitors contact number in contact us form. Add the following line in your form_validation.php
array(‘field’ => ‘contact_number’,'label’ => ‘contact number’,'rules’ => ‘required’),
and a text box in your view file which might locate at view/contact/contact_us.php
[input type="text" name="contact_number" value="<php echo set_value('fr', $default['fr']); >”]
that’s all.
you have not opened your controller and model file. Real power of MVC
5 Comments so far
Leave a comment
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Cool, perfect optimized code.
Comment by Rumana October 29, 2008 @ 11:48 pma very useful post amin bhai …..
Comment by Nadia Ahmed October 30, 2008 @ 12:02 amUseful!!! No man(wo). it’s powerful not useful
Comment by admin October 30, 2008 @ 12:08 amHmm. 100% vua posting
Comment by mamun October 30, 2008 @ 12:29 amYou are absolutely correct !!! Former two are wrong. ha ha ha But upni bujlen kevabe? Upni to pura …..
Comment by admin October 30, 2008 @ 12:40 am