Simple Form Error - New to CodeIgniter but not PHP |
[eluser]Unknown[/eluser]
I am looking at translating a current project of mine from its messy state to the codeigniter system and I am just screwing around with some stuff until I get comfortable with it. I am trying to do a simple form, a registration form. Right now I just want to verify fields. Controller > register.php: Code: <?php Views > regform.php Code: <html> However when I fill out the form, or heck even leave it blank it takes me from my original URL: http://127.0.0.1/~steve/index.php/register/ to this:http://127.0.0.1/~steve/index.php/register/index.php/register (it throws on a extra index.php/register with the URL, or if I start with just /index.php/register (no trailing slash) it takes me to /index.php/register/index.php (throws on a extra index.php). I am sure this is end user error, can anyone kindly point me to the source of my error. Thanks! -Steve
[eluser]tinawina[/eluser]
Just a thought, but usually what I do is set up a specific method to handle a form. Where you have everything happening in your index() method, which is the default method that will be called when you call up your controller, you might try adding in a handleRegistration method or the like. Then bounce all of your validation and processing code into that method. Also you don't have a constructor set up. Maybe try something like this in your controller: Code: class Register extends Controller { And in your view file: Code: <html> I hope that helps, or at least gets you moving in the right direction!
[eluser]Unknown[/eluser]
Thanks for the fast reply! As a current college CS major I cant believe I forgot to add a constructor. Using your code, I made some various changes to make it work (display without errors) however when I submit it the URL goes from: http://www.phpsn.net/index.php/register/ To http://www.phpsn.net/index.php/register/...gistration Why is it doing this? Any ideas?
[eluser]Michael Wales[/eluser]
Check to make sure your base_url in config.php is correct. |
Welcome Guest, Not a member yet? Register Sign In |