Get and Post wont work ? |
[eluser]DJMOHNL[/eluser]
I have some trouble getting $this->input->post() and $this->input->get() getting to work. As i have developed multiple websites with CI and never had this problem. If i put a get string inside the URL (browser addressbar) CI shows a 404 error. The config query strings are enabled, my .htacces is as followed: Code: RewriteEngine On $config['enable_query_strings'] = TRUE; $config['controller_trigger'] = 'c'; $config['function_trigger'] = 'm'; $config['directory_trigger'] = 'd'; // experimental not currently in use $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; i need to have both uri strings and segment to be connected to eachother. like: http://site.ext/controller/method/?key=something it worked before with other websites (same hosting and other hosting) -> recently updated all plesk modules(applications) i dont know what the cause of this problem is, cant find anything on google nor ci forums. Tried everything on the forums about _GET and mod_rewrite nothing worked aso i have: Code: function _remap($method) Can someone hep me out here ? (its for the OpenSource Projects) thanks!
[eluser]WanWizard[/eluser]
CI supports routing by URI segments (if 'enable_query_strings' is FALSE), or by query string parameters (if 'enable_query_strings' is TRUE). You can't have both in the default setup, when using URI segment routing, CI will strip and remove the query string. Use the search option of find a workaround for this, this has been discussed many times. (hint: search for 'allow_get_array').
[eluser]DJMOHNL[/eluser]
[quote author="WanWizard" date="1280347900"]CI supports routing by URI segments (if 'enable_query_strings' is FALSE), or by query string parameters (if 'enable_query_strings' is TRUE). You can't have both in the default setup, when using URI segment routing, CI will strip and remove the query string. Use the search option of find a workaround for this, this has been discussed many times. (hint: search for 'allow_get_array').[/quote] yo, my problem is i cant get any post or get parameters send by a form ... normally it does work, but now it doesnt work ... i cant seem to find why and there nothing on this forum that tells me how i should solve this. About the query strings, ITS not working eighter a form with method="get" doesnt work, even when query strings are enabled, disabled of if my Code: $config['uri_protocol'] = "AUTO";
[eluser]WanWizard[/eluser]
Check the manual. If you enable query strings, you enable them for routing only. CI will expect a query string like http://www.example.org?c=controller&m=method, and not every method of helper supports this (they expect URI segments). Enable query string doesn't mean "allow all possible query strings to work". The fact that posts don't work is probably related to you enabling query strings as well, as that will disable segment routing so none of your controllers will be accesable anymore...
[eluser]DJMOHNL[/eluser]
this cant be, ive had urls like: http://mysite.ext/controller/method?getv...rrr&z=ijsf it worked before, i dont know why it wont work now. Also when i submit my form with method get, it doesnt append the get vars to the url (or get stripped by something) and when the form method is set to post and i try $this->input->post('thenameofthevar') it wont work.. Really dont know why my get and post wont work. if i put a get var to my url i cant extract it with the $this->input->get('thenameofvar') it wont work... I really need this website to be up an running soon, its an OpenSource Project but some of my php settings might be doing this or ?
[eluser]DJMOHNL[/eluser]
also i dont want to use: http://www.example.org?c=controller&m=method but http://www.example.org/controller/method...s=getparam
[eluser]pbreit[/eluser]
Querystrings are minimally supported in CodeIgniter. Look here for some solutions: http://ellislab.com/forums/viewthread/159382/ And register your vote for proper querystring support in CodeIgniter!
[eluser]WanWizard[/eluser]
[quote author="DJMOHNL" date="1280435783"]this cant be, ive had urls like: http://mysite.ext/controller/method?getv...rrr&z=ijsf it worked before, i dont know why it wont work now.[/quote] Not with standard CI you didn't. Unless you have some code that parsed $_SERVER['QUERY_STRING'], because that should still be available. [quote author="DJMOHNL" date="1280435783"]Also when i submit my form with method get, it doesnt append the get vars to the url (or get stripped by something)...[/quote] I've already explained this, but if you don't read... We're only trying to help. If you don't want our help, just say so...
[eluser]DJMOHNL[/eluser]
on my log it tells me: Code: DEBUG - 29-07-2010 20:45:42 --> Config Class Initialized * edited for security reasons (it was my domain name in the log edited here) it tells me this: DEBUG - 29-07-2010 20:45:42 --> Global POST and COOKIE data sanitized i cant seem to know what 'sanitized' means (google tells me in dutch its cleaned) and my Code: $config['global_xss_filtering'] = FALSE; Code: $config['enable_query_strings'] = FALSE; using this form: Code: <form method="get" action="zoek/"> Code: $keyword = $this->input->post('key'); ? i have read all above, none still working not even the CI 2 Get Parameters patch. -> PHP Version 5.2.13 -> Apache 2.0 Handler -> register_globals Off -> safe_mode Off -> always_populate_raw_post_data Off apache and php (and everything arround) was updated a few days ago (before it know it was working with other domains (cant check it out unfortunately)
[eluser]WanWizard[/eluser]
Which patch are you talking about? Mine, from the post @pbreit referred you to? That should work like a charm, providing you have 'enable_query_strings' to FALSE, and 'allow_get_array' to TRUE. If I test this here with the URL Code: http://test.catwoman.exite.local/en/homepage.html?foo=bar&bar=foo it uses 'en/homepage' to route to the correct controller, and in that controller, Code: var_dump($_GET); |
Welcome Guest, Not a member yet? Register Sign In |