Re: How to get data from forms?
Hi ... I had the same problem ... but I have another question. I don't see this approach as very MVC oriented. Let me explain: If I access the data using direct access to array, if i modify names of attributes in Model or in View, the application logic won't be consistent anymore. Isn't there a way to parametrize this kind of actions so that they automatically reflect changes to the model? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
How to get data from forms?
Hi all! I've just been introduced to Cake world! But I have some problems in understanding how the framework handles the data from forms. I've done a simple model 'User' (username password as attributes), and then I've created a controller with: * an 'index' action that displays a login form * a 'login' action that does the login (not implemented yet ;) I currently have problems because I can't understand how data passing is handled by the framework! How can I refer to parameters from the login form in the login action? This is the index.thtml h1Login/h1 ?php echo $html-formTag('/users/login')? pUsername: ?php echo $html-input('User/username', array('size' = '40'))? ?php echo $html-tagErrorMsg('User/username', 'Username is required.') ?/p pPassword: ?php echo $html-password ('User/pass', array('size' = '40')); ? ?php echo $html-tagErrorMsg('Users/pass', 'Password is required.') ?/p p?php echo $html-submit('Login') ?/p /form = How can I refer to the params from here in the login action function? I'm getting mad, I've read all the manuals and the blog tutorial but I still can't figure it out . Thank you for your attention, and keep up the great work! :* --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: How to get data from forms?
look in the $this-params['data'] try using pr(); a shortcut for print_r or you can now use $this-data, if you need the name of the button pushed you can also look in $this-params['form']Sam D On 4/20/06, Ashley [EMAIL PROTECTED] wrote: Hi all!I've just been introduced to Cake world! But I have some problems inunderstanding how the framework handles the data from forms. I've donea simple model 'User' (username password as attributes), and then I've created a controller with:* an 'index' action that displays a login form* a 'login' action that does the login (not implemented yet ;)I currently have problems because I can't understand how data passing is handled by the framework! How can I refer to parameters from thelogin form in the login action?This is the index.thtmlh1Login/h1 ?php echo $html-formTag('/users/login')?pUsername: ?php echo $html-input('User/username', array('size'= '40'))??php echo $html-tagErrorMsg('User/username', 'Username is required.') ?/ppPassword:?php echo $html-password ('User/pass', array('size'= '40')); ??php echo $html-tagErrorMsg('Users/pass', 'Password isrequired.') ?/p p?php echo $html-submit('Login') ?/p/form=How can I refer to the params from here in the login action function? I'm getting mad, I've read all the manuals and the blog tutorial but Istill can't figure it out .Thank you for your attention, and keep up the great work!:* --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---