• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem posting form to a file

#1
[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.

#2
[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'>

#3
[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.

#4
[eluser]junaids[/eluser]
i have tried that too like,
<code>
&lt;form action="../controllers/signupform/registration" method="post"&gt;

</code>
but it doesnt work that way too

#5
[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:
&lt;form action="&lt;?php echo site_url('signupform/registration'); ?&gt;" method="post"&gt;

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.

#6
[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
"&lt;?php echo site_url('signupform/register'); ?&gt;"
Call to undefined function site_url() in C:\xampp\htdocs\codeigniter\system\application\views\signup.php on line 89

#7
[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. Smile

#8
[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:
&lt;form action=”../controllers/signupform/registration” method=“post”&gt;
error"class controller not found"

and then like this,
Code:
&lt;form action="&lt;?php echo site_url('signupform/registration'); ?&gt;" method="post"&gt;
error"site_url() is undefined function"
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.

#9
[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.

#10
[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. Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.