CodeIgniter Forums
method accessing problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: method accessing problem (/showthread.php?tid=25107)



method accessing problem - El Forum - 12-01-2009

[eluser]hamzakhan[/eluser]
i have update form with this url
http://localhost/server/sscart/admin/catagory/Update/64

and form action
<form action="catagory/UpdateDetails" method="post">
controller/method

but the problem is that when i submit the form
the url will look like this
http://localhost/server/sscart/admin/catagory/Update/catagory/UpdateDetails

catagory/UpdateDetails

UpdateDetails -- is a method in catagory controller.which is updating the values of the form

and UpdateDetails is not accessable with this url
http://localhost/server/sscart/admin/catagory/Update/catagory/UpdateDetails

how i can access the updateDetails mehtod


method accessing problem - El Forum - 12-01-2009

[eluser]richzilla[/eluser]
When you submit your form its submitting to a url relative to its existing url. So if your already on catagory/update it will simply add the whatevers in the action parameter to the end of that.


The simplest solution is to use CI's form helper and use the form_open method, which will direct you to the correct url.


method accessing problem - El Forum - 12-01-2009

[eluser]richzilla[/eluser]
So at the top of your controller (or in your autoload file):

Code:
$this->load->helper('form')

And in your view, where you have the html form element, replace that with:

Code:
<?php echo form_open('catagory/UpdateDetails'); ?>



method accessing problem - El Forum - 12-01-2009

[eluser]hamzakhan[/eluser]
[quote author="ricardino" date="1259688380"]When you submit your form its submitting to a url relative to its existing url. So if your already on catagory/update it will simply add the whatevers in the action parameter to the end of that.


The simplest solution is to use CI's form helper and use the form_open method, which will direct you to the correct url.[/quote]



Thanks you so much for this help
now its working according to my expectations.


method accessing problem - El Forum - 12-01-2009

[eluser]hamzakhan[/eluser]
[quote author="ricardino" date="1259688707"]So at the top of your controller (or in your autoload file):

Code:
$this->load->helper('form')

And in your view, where you have the html form element, replace that with:

Code:
<?php echo form_open('catagory/UpdateDetails'); ?>
[/quote]


u r gr8 in codeigneter
u r doing axactly what i am not
doing.


again thanks buddy