value pssing |
[eluser]jis[/eluser]
hai to all how to pass a value from view to the controller file pls help is ther any code with u..?
[eluser]WanWizard[/eluser]
A view doesn't generate data, it only displays it. What kind of information do you want to pass? Example?
[eluser]jis[/eluser]
actually i just want to call a function that is in controlleris that possible example Controller.php class helo extends controller { function index() { } function sample() {echo "fgg"" } } view.php somthing like this.... $this->sample(); is this possible i dont know i am asking any junks becz i am new this concept..
[eluser]WanWizard[/eluser]
The standard way of working is the other way around. If you need information from a method (model, library or controller), you do Code: $data['sample'] = $this->sample(); and then the result of the sample() method is available in your view via $sample. You should never generate output outside the output class. If output compression is off, it will end up at the wrong place, if it is on, you end up with a blank page.
[eluser]jis[/eluser]
thank WanWizard you that will also solve my prblm thnk you for spending time for me
[eluser]jis[/eluser]
how it done in this case <?php if(isset($_POST['blogs'])) ................ ?> </ol> <form name="f1" method="post"> <input type="submit" name="blogs" id="blogs" value="blog" /> </form> i need to display the content of a methods in cotroller in the button action is that possible
[eluser]WanWizard[/eluser]
Another tip: do not ever use unvalidated and unfiltered information anywhere in your application, so no references to $_POST. Anything can be posted, you can't trust its content. This works the same as the previous example: Code: $data['sample'] = $this->sample(); In your view: Code: <php if ( $has_blogs )
[eluser]jis[/eluser]
thank u WanWizard could you pls do me one for favor pls.... pls give me sample code that will help me to under stand the data flow of mvc in CI pls for exapmle a take value from databse and display it in the text box...... pls
[eluser]bretticus[/eluser]
[quote author="jis" date="1283336257"]thank u WanWizard could you pls do me one for favor pls.... pls give me sample code that will help me to under stand the data flow of mvc in CI pls for exapmle a take value from databse and display it in the text box...... pls[/quote] Have you not watched the introduction screen cast tutorials? Here is the link with links to other helpful tutorials. |
Welcome Guest, Not a member yet? Register Sign In |