cakephp - To retrieve value from a text box in a form (view) to controller in cake php -
How to get the value for the controller in cake php in a form (see) from a text box?
<> Here is an example of the KHHHP Book when saving your model data: function editing (div)
$ Id) {// Has any form data been posted? If (! Empty ($ ---> data)) // if the form data can be validated and saved ... if ($ this-> Recipe-> Save ($ this- & gt; ; Data)) {// Set up a session flash message and redirect. $ This- & gt; Session-> Set flash ("cookie saved!"); $ This- & gt; Redirect ('/ recipes'); }} // If there is no form data, edit the method to edit // and keep it on view. $ This- & gt; Set ('recipe', $ this- & gt; cookie- & gt; findById ($ id)); }
If your model was a recipe, and your input was named "title", then the value will be in $$ -> data ['recipe'] ['title' ], If you can set your scene like this:
$ echo-> gt; Form- & gt; Create ('recipe'); Echo $ the-> Form- & gt; Hidden ('id'); Echo $ the-> Form- & gt; Input ('title'); Echo $ this-> Form- & gt; End ('Save Recipe');
So, here:
Try doing more blog tutorials, this can help you get started:
< / Html>
Comments
Post a Comment