The form needs to be created with a name and then it also needs to
end:
$form->create('FormName');
$form->input( ... etc etc );
$form->end('Submit');
And you should be able to access your form data via $this-
>data['FormName'][ inputfield ].
On Jul 8, 1:31 pm, Tomfox Wiranata <[email protected]> wrote:
> hi,
>
> i am trying to extract data from a form to update user information.
> but somehow i cant extract the information from the form. i echo the
> current information in input fields. everything works fine. the
> echoing, the calling of my "updateProfile" function from my view:
>
> <span class="profiledata"><?php echo $form->input('created',
> array('value' => $user['created'])); ?></span>
>
> <?php echo $form->create('User', array('action' => 'updateProfile'));?
>
> <div class="button"> <?php echo $form->button('Sichern', array('type'
> => 'submit'));?> </div>
>
> my function that updates the given info
>
> function updateProfile()
> {
>
> $updates =
> $this->User->findByUsername($this->Session->read('User.username'));
>
> WORKS -> $updates['User']['firstname']=
> 'Trötde';
> WORKS ->
> $updates['User']['lastname']='tröter';
> sends NULL ->
> //$updates['User']['username']=$this->data['User']
> ['username'];
> sends NULL ->
> $updates['User']['created']=$this->data['User']
> ['created'];
>
> if ( $this->User->save($updates)){
> $this->Session->setFlash('Profil
> aktualisiert');
> $this->redirect(array('controller' =>
> 'users', 'action' =>
> 'profile'));
> }
> else{
> $this->Session->setFlash('Speichern
> fehlgeschlagen');
> $this->redirect(array('controller' =>
> 'users', 'action' =>
> 'editprofile'));
> }
>
> }
>
> now if i set values as string, like "trötde" above, it works. so the
> saving process is correct. but if i wanna get the data from the form
> with "$this->data['User']['created']" the value is null..
>
> can u see the problem ?? thx :)
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en