Welcome Guest, Not a member yet? Register   Sign In
weird problem with form helper

Hi all,

I've got a weird problem with the form helper. I'm setting an array in my controller, which I use to build my form.

$data['form'] = array(
    'hidden' => array(
        'name' => 'tutID',
        'value' => $tutID
    'name' => array(
        'name' => 'name',
        'id' => 'name',
        'value' => $this->validation->name
    'password' => array(
        'name' => 'password',
        'id' => 'password'
    'email' => array(
        'name' => 'email',
        'id' => 'email',
        'value' => $this->validation->email
    'message' => array(
        'name' => 'message',
        'id' => 'message',
        'value' => $this->validation->message
    'submit' => array(
        'name' => 'submComment',
        'value' => 'Submit'
And then in my view I use this:
    <?=form_hidden($form['hidden']), "\n"?>
    <p><label for="name">NAME&nbsp;&nbsp;<span class="small green">( required )</span><br />
    <p><label for="password">PASSWORD&nbsp;&nbsp;<span class="small green">( if you are a forum member )</span><br />
    <p><label for="email">EMAIL&nbsp;&nbsp;<span class="small green">( required, but won't be published )</span><br />
    <p><label for="message">MESSAGE&nbsp;&nbsp;<span class="small green">( required )</span><br />

However, the weird thing is, in my source code, I suddenly see this:
&lt;input type="hidden" name="name" value="tutID" /&gt;&lt;input type="hidden" name="value" value="192" />

[eluser]Randy Casburn[/eluser]
&lt;?=form_hidden($form['hidden']), "\n"?&gt;

the form_hidden() function does not take an array as an argument -- check the docs

That's a start..


I always check the docs, I just didn't think of the fact it wouldn't take array's, just like all the other form_ helpers. edit, thanks though. problem solved now.

[eluser]Randy Casburn[/eluser]
I just meant "verify what I'm saying because this is off the top of my head and sometimes I'm a fool". -- Didn't mean to come off as offensive - :red:


No worries no worries. I'm not offended and didn't want to appear though. I was merely making excuses for myself why I didn't properly check the docs :p

That's the downside of internet communication... Without emoticons, we'd be lost. Smile

Theme © iAndrew 2016 - Forum software by © MyBB