problem posting form to a file |
[eluser]junaids[/eluser]
hi i m new to CI. I have built a form for user registration. in form tag action is specified as a model.. but i get an error."class model not found" any suggestions plz.
[eluser]bretticus[/eluser]
Without the tinniest jott of code, I can only assume. However, you did say: [quote author="junaids" date="1239409085"] in form tag action is specified as a model.. but i get an error."class model not found"[/quote] Are you saying that you are referencing a model class as the action attribute of your form tag in html? Code: <form action='model'>
[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums! The action attribute needs to point to a controller method. Controller methods are the only way to access your application from the outside. You can not access a model directly.
[eluser]junaids[/eluser]
i have tried that too like, <code> <form action="../controllers/signupform/registration" method="post"> </code> but it doesnt work that way too
[eluser]TheFuzzy0ne[/eluser]
As far as your form is concerned, you are calling the controller name and method - not accessing it like you would a CSS file. Code: <form action="<?php echo site_url('signupform/registration'); ?>" method="post"> I would strongly suggest you check out [url="http://ellislab.com/forums/viewthread/107773/"]this thread[/url]. It contains just about everything you should ever need to know to get you started with CodeIgniter.
[eluser]junaids[/eluser]
i have accessed the code as u mentioned like a css file. i autoloaded url helper, and also loaded it in the controller. but i m getting an error on this line "<?php echo site_url('signupform/register'); ?>" Call to undefined function site_url() in C:\xampp\htdocs\codeigniter\system\application\views\signup.php on line 89
[eluser]TheFuzzy0ne[/eluser]
Oops, My bad! You'll need to load the url helper: Code: $this->load->helper('url'); I wasn't suggesting that you access it like a CSS file, I was saying that this is how you were doing it, but shouldn't be.
[eluser]junaids[/eluser]
hi. i know that working with CI is quite simple. but at the moment i m stuck with this problem. so if u please help me out. first i was writing the form tag as, Code: <form action=”../controllers/signupform/registration” method=“post”> and then like this, Code: <form action="<?php echo site_url('signupform/registration'); ?>" method="post"> i have loaded the url helper Code: $this->load->helper('url'); where signupform is the controller and registration is the function i m getting error on both of them so if u please help me on this.
[eluser]TheFuzzy0ne[/eluser]
site_url() is defined in the URL helper, so as long as that's loaded first, you shouldn't have a problem.
[eluser]bretticus[/eluser]
Have you watched these tutorial videos? They are excellent! If not, I suggest you watch them. Even if you have, I suggest you watch them one more time. |
Welcome Guest, Not a member yet? Register Sign In |