Welcome Guest, Not a member yet? Register   Sign In
Post Data Gives 404 [solved]
#1

[eluser]jed726[/eluser]
I am new to working with Code Igniter and I'm having an interesting problem. It seems that whenever I submit a form within CI, no matter which URL I send it to, results in a 404 error.

At the moment I am just try to reload the same page via action="$_SERVER['PHP_SELF']" but it gives a 404 when the post data is in the air. If I refresh the page again, without post data being submitted, the page loads fine and all is perfect.

I have tried setting the action to my standard home page in hopes of just getting it to load, but no success. I know I may be missing something simple, but this is driving me crazy! I have looked over my source code for the form and everything seems to have rendered as it should.

If anyone would like to take a look I can PM you the URL of the offending pages.

Thank you so much and I appreciate any and all assistance.
#2

[eluser]Grahack[/eluser]
Yeah, if your install is live, please give us an URL.
You say that the pages load fine without post data, but not when it loads after a POST from a form, it 404s?
I thought about your base_url item, about the action of your form (don't set it to "get"), dunno...
#3

[eluser]jed726[/eluser]
The form in question is on this page in the right-hand column:
[link removed]

Notice if you submit the form that the page is not rendered...but if you then hit refresh on the same exact link, everything is fine. I am not sure what might be causing this.
#4

[eluser]Grahack[/eluser]
I see this in the action of your form http://www.jordandiamond.com/CodeIgnitor...ocess2.php

What is your php code that opens the form? It does't seem to be correct.
#5

[eluser]Thoer[/eluser]
ok, you'll probably need to set your base url correctly in the config/config.php
in case it is set than make sure your .htaccess file is correct.
#6

[eluser]jed726[/eluser]
[quote author="Grahack" date="1197920030"]I see this in the action of your form http://www.jordandiamond.com/CodeIgnitor...ocess2.php

What is your php code that opens the form? It does't seem to be correct.[/quote]

I switched it to that page really quick to test something out. What I'm really trying to do is refresh the same page with the post data intact. I've fixed the form's action to serve the same exact page.

You see, I haven't yet written the code to receive the form data...I just want to be able to receive it first without crashing.

I don't have an htaccess file setup for the site yet...but I'm not sure if that would be the problem. The same exact URL loads perfectly fine if there is no post data.

I want to thank you guys again for you input and I am still trying as many things as I can to figure this out and get on with my project. Before this all happened, I have been blown away by the flexibility of Code Igniter and I am pretty well hooked on using this for my future projects. I understand this is not a normal problem (google told me so), and it may have something to do with my webspace or configuration. If anyone has any other suggestions please let me know.
#7

[eluser]Michael Wales[/eluser]
Quote:What I’m really trying to do is refresh the same page with the post data intact.

Code:
<?= form_open('controller/method'); ?>

Use the same controller/method that is calling the form's view file.
#8

[eluser]jed726[/eluser]
[quote author="Michael Wales" date="1197931454"]
Code:
<?= form_open('controller/method'); ?>

Use the same controller/method that is calling the form's view file.[/quote]

That's exactly what I am trying to do...load the exact same page. The form action seems to render the same if I use:
Code:
<?= form_open('photography/gallery/$var/$var2/$var3'); ?>
or if I use
Code:
<?= form_open($_SERVER['PHP_SELF']); ?>

The problem is that no page will load when the form data is posted. It seems like code igniter is not being initialized at all in that case...because otherwise I would get a code igniter error and not a general server error.

I tried creating another form on a different page with the same result. I have activated the profiler to see that the post data is not posting...but code ignitor doesn't seem to be loading at all. This seems very odd.

I tried deleting the htaccess file from my root directly with little success. I am stuck.
#9

[eluser]jed726[/eluser]
Hi guys, I just wanted to let you know that I have fixed the problem and I am incredibly relieved. It had to do with the fact that my codeignitor is in a subfolder and, as one poster suggested, the base url was not set as it should have been. Thank you all so much and once again I truly appreciate all of your input. :cheese:




Theme © iAndrew 2016 - Forum software by © MyBB