CodeIgniter data not posting
- August 1st, 2010
- By jzerbe
- Write comment
I have been working in this PHP MVC framework called CodeIgniter for the past few weeks. I learned yesterday, that if some of your post data is missing. It is most likely because CodeIgniter auto-closed your form due to bad markup. I have something like the following:
<fieldset>
<?php echo form_open(‘somecontroller/some_function’); ?>
… some form fields ….
</fieldset>
<fieldset>
… some more form fields …
</fieldset>
<?php echo form_close(); ?>
Guess who wasn’t getting all of the data posted? This guy! CI auto-closed the form at the first </fieldset> tag. Remember kids, always open your forms and close your form outside of any tags that might close before the form closes. Like this:
<?php echo form_open(‘somecontroller/some_function’); ?>
<fieldset>
… some form fields ….
</fieldset>
<fieldset>
… some more form fields …
</fieldset>
<?php echo form_close(); ?>
