1

I am getting the following error in my CodeIgniter install which I cant seem to solve:

A PHP Error was encountered Severity: Notice

Message: Array to string conversion

Filename: helpers/form_helper.php

Line Number: 515

Here is my code

 <div class="control-group">
                <?php $attributes = array('class' => 'control-label'); echo form_label(lang('settings_dateofbirth'),$attributes); ?>
                <div class="controls">   
                <?php $m = $this->input->post('settings_dob_month') ? $this->input->post('settings_dob_month') : (isset($account_details->dob_month) ? $account_details->dob_month : ''); ?>
                <select name="settings_dob_month" class="span1">
                    <option value=""><?php echo lang('dateofbirth_month'); ?></option>
                    <option value="1"<?php if ($m == 1) echo ' selected="selected"'; ?>><?php echo lang('month_jan'); ?></option>
                    <option value="2"<?php if ($m == 2) echo ' selected="selected"'; ?>><?php echo lang('month_feb'); ?></option>
                    <option value="3"<?php if ($m == 3) echo ' selected="selected"'; ?>><?php echo lang('month_mar'); ?></option>
                    <option value="4"<?php if ($m == 4) echo ' selected="selected"'; ?>><?php echo lang('month_apr'); ?></option>
                    <option value="5"<?php if ($m == 5) echo ' selected="selected"'; ?>><?php echo lang('month_may'); ?></option>
                    <option value="6"<?php if ($m == 6) echo ' selected="selected"'; ?>><?php echo lang('month_jun'); ?></option>
                    <option value="7"<?php if ($m == 7) echo ' selected="selected"'; ?>><?php echo lang('month_jul'); ?></option>
                    <option value="8"<?php if ($m == 8) echo ' selected="selected"'; ?>><?php echo lang('month_aug'); ?></option>
                    <option value="9"<?php if ($m == 9) echo ' selected="selected"'; ?>><?php echo lang('month_sep'); ?></option>
                    <option value="10"<?php if ($m == 10) echo ' selected="selected"'; ?>><?php echo lang('month_oct'); ?></option>
                    <option value="11"<?php if ($m == 11) echo ' selected="selected"'; ?>><?php echo lang('month_nov'); ?></option>
                    <option value="12"<?php if ($m == 12) echo ' selected="selected"'; ?>><?php echo lang('month_dec'); ?></option>
                </select>
                <?php $d = $this->input->post('settings_dob_day') ? $this->input->post('settings_dob_day') : (isset($account_details->dob_day) ? $account_details->dob_day : ''); ?>
                <select name="settings_dob_day" class="span1">
                    <option value="" selected="selected"><?php echo lang('dateofbirth_day'); ?></option>
                    <?php for ($i=1; $i<32; $i++) : ?>
                    <option value="<?php echo $i; ?>"<?php if ($d == $i) echo ' selected="selected"'; ?>><?php echo $i; ?></option>
                    <?php endfor; ?>
                </select>
                <?php $y = $this->input->post('settings_dob_year') ? $this->input->post('settings_dob_year') : (isset($account_details->dob_year) ? $account_details->dob_year : ''); ?>
                <select name="settings_dob_year" class="span1">
                    <option value=""><?php echo lang('dateofbirth_year'); ?></option>
                    <?php $year = mdate('%Y', now()); for ($i=$year; $i>1900; $i--) : ?>
                    <option value="<?php echo $i; ?>"<?php if ($y == $i) echo ' selected="selected"'; ?>><?php echo $i; ?></option>
                    <?php endfor; ?>
                </select>
                <?php if (isset($settings_dob_error)) : ?>
                <span class="field_error"><?php echo $settings_dob_error; ?></span>
                <?php endif; ?>
            </div>
            </div>

Can someone explain what this relates to?

1
  • Would you mind telling us, where is the line 515 is? Commented Aug 22, 2012 at 8:28

1 Answer 1

2

The error refers to the form_label. The second parameter should be a string while the third can be an array.

 form_label(lang('settings_dateofbirth'), 'dateofbirth', $attributes);
Sign up to request clarification or add additional context in comments.

1 Comment

awesopme it worked ill except as soon as it lets me thankyou ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.