views:

86

answers:

2

Hi I was following code igniter user guide for forms and I encountered this strange output can anyone tell how to fix it?

Here is my code for beginning of the form

<?=$attributes = array('class' => 'email', 'id' => 'myform');?>
<?=form_open('email/index/', $attributes); ?>

I get form with id and class which I specified above but for some reason annoying Array text prints out and I cant figure out why, can anyone help? thank you

+2  A: 

Try

<? $attributes = array('class' => 'email', 'id' => 'myform');?>
<?=form_open('email/index/', $attributes); ?>

The <?= ?> is a shortcut to <?php echo ... ?>, so your $attributes array would not only be created, but also printed.

The <? ?> is a shortcut for <?php ?> so that should fix it.

Atli
Oops totall missed that that was an echo. Good call.I hate short tags :-)
prodigitalson
Yea, I hate those tags too. Nothing but trouble :)
Atli
You nailed it, thank you
Gandalf StormCrow
A: 

You are evaluating an Array type variable to a string somewhere. It may have nothing to do with the form. Were you trying to echo/print somethign else up higher in the processing chain for debug that happens to be an array?

prodigitalson