Re: [PHP] Redirect via GET is loosing characters
Merlin schrieb: Hi there, I am checking plausability inside a php script that receives a POST submit. If an error occures the user should be redirected back, along with his original data filled into the forms. There is a problem with this. As the GET method, which the redirect is using, only allows a certain amount of characters, the text is always cut down. I use this: HEADER(Location:.$data[rurl].?error=.$error.$parameter); Is there a way to redirect the user to the form and fill in large text? Thank you for your help, Best regards, Merlin This is a normal behaviour. Webservers trim the GET-request at a certain length. You have several options: - don't do a redirect but return the form, with most clean frameworks it should be no problem to include the action wich generates the form - save the variables in a session, then send the redirect-header and clean the session after regenerating the form - save the variables in a cookie stored at the client and clean the cookie afterwards (ugly) Greetings, -- Thomas 'Neo' Weber Webmaster GothNet.eu | Gothic-Chat.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirect via GET is loosing characters
Hi there, I am checking plausability inside a php script that receives a POST submit. If an error occures the user should be redirected back, along with his original data filled into the forms. There is a problem with this. As the GET method, which the redirect is using, only allows a certain amount of characters, the text is always cut down. I use this: HEADER(Location:.$data[rurl].?error=.$error.$parameter); Is there a way to redirect the user to the form and fill in large text? Thank you for your help, Best regards, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect via GET is loosing characters
Merlin wrote: I am checking plausability inside a php script that receives a POST submit. If an error occures the user should be redirected back, along with his original data filled into the forms. There is a problem with this. As the GET method, which the redirect is using, only allows a certain amount of characters, the text is always cut down. I use this: HEADER(Location:.$data[rurl].?error=.$error.$parameter); Is there a way to redirect the user to the form and fill in large text? http://php.net/session -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect via GET is loosing characters
On Thu, May 3, 2007 9:26 am, Merlin wrote: I am checking plausability inside a php script that receives a POST submit. If an error occures the user should be redirected back, along with his original data filled into the forms. There is a problem with this. As the GET method, which the redirect is using, only allows a certain amount of characters, the text is always cut down. I use this: HEADER(Location:.$data[rurl].?error=.$error.$parameter); Is there a way to redirect the user to the form and fill in large text? Not really, no, not with the re-direct... But why do you feel the need to do a re-direct anyway? With a simple re-structuring of your code, you can just do an include to get the form back in with the data pre-filled, and have them try again. Why waste an HTTP connection, more hard drive hits to include all your function libraries (or whatever), ...? You've already GOT all the info you need in your hands right there to display what you want to display. Just display it. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect via GET is loosing characters
Beating a dead horse here, since it's been mentioned twice already, but yeah --- $_SESSION's are the way to go with this. ? session_start(); $_SESSION['error'] = $error; $_SESSION['parameter'] = $parameter; header(Location:.$data[rurl]); exit; ? And wherever you have your error handling, do: ? session_start(); // If not called from a header.php-like start file. if($_SESSION['error']) { // Do something with $_SESSION['error'] and $_SESSION['parameter'] } ? And for the record, it's not just the HTTP server that trims it, but the browser generally does, as well, to avoid things such as memory leaks, et cetera. Internet Exploder, for example, has had a limit of 2,083 total characters in a GET request, but the actual RFC for HTTP/1.1 has no limit for the protocol (RFC 2616 Section 3.2.1). And slightly off-topic, but think about how much the web has changed in the last 20 years (well, 17, since the HTTP protocol came about in 1990) and then think about the fact that it's all still based on nothing higher than version 1.1. On 5/3/07, Neo [GC] [EMAIL PROTECTED] wrote: Merlin schrieb: Hi there, I am checking plausability inside a php script that receives a POST submit. If an error occures the user should be redirected back, along with his original data filled into the forms. There is a problem with this. As the GET method, which the redirect is using, only allows a certain amount of characters, the text is always cut down. I use this: HEADER(Location:.$data[rurl].?error=.$error.$parameter); Is there a way to redirect the user to the form and fill in large text? Thank you for your help, Best regards, Merlin This is a normal behaviour. Webservers trim the GET-request at a certain length. You have several options: - don't do a redirect but return the form, with most clean frameworks it should be no problem to include the action wich generates the form - save the variables in a session, then send the redirect-header and clean the session after regenerating the form - save the variables in a cookie stored at the client and clean the cookie afterwards (ugly) Greetings, -- Thomas 'Neo' Weber Webmaster GothNet.eu | Gothic-Chat.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107
Re: [PHP] Redirect via GET is loosing characters
If it's on the same domain/user account, that's probably a better idea but with $data['rurl'] being used, I'm (ignorantly) assuming that RURL = Remote URL. On 5/3/07, Richard Lynch [EMAIL PROTECTED] wrote: On Thu, May 3, 2007 9:26 am, Merlin wrote: I am checking plausability inside a php script that receives a POST submit. If an error occures the user should be redirected back, along with his original data filled into the forms. There is a problem with this. As the GET method, which the redirect is using, only allows a certain amount of characters, the text is always cut down. I use this: HEADER(Location:.$data[rurl].?error=.$error.$parameter); Is there a way to redirect the user to the form and fill in large text? Not really, no, not with the re-direct... But why do you feel the need to do a re-direct anyway? With a simple re-structuring of your code, you can just do an include to get the form back in with the data pre-filled, and have them try again. Why waste an HTTP connection, more hard drive hits to include all your function libraries (or whatever), ...? You've already GOT all the info you need in your hands right there to display what you want to display. Just display it. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107
Re: [PHP] Redirect via GET is loosing characters
Ah, i thought to remember that the limit is lower on IIS than on Apache, maybe i've just some memory faults. ;) GET is meant to define what to GET, not to define content. This sounds a bit academic, but remember that the GET-args are a part of the URI and so will also go into the http-log for example. One don't want to have 2kb per log-line. ;) Additionally, please think of the great talent of users to fuck things up: GET-args will become bookmarks, links etc. and WILL do funny things when overused (session-ids...). ;) Daniel Brown schrieb: Beating a dead horse here, since it's been mentioned twice already, but yeah --- $_SESSION's are the way to go with this. ? session_start(); $_SESSION['error'] = $error; $_SESSION['parameter'] = $parameter; header(Location:.$data[rurl]); exit; ? And wherever you have your error handling, do: ? session_start(); // If not called from a header.php-like start file. if($_SESSION['error']) { // Do something with $_SESSION['error'] and $_SESSION['parameter'] } ? And for the record, it's not just the HTTP server that trims it, but the browser generally does, as well, to avoid things such as memory leaks, et cetera. Internet Exploder, for example, has had a limit of 2,083 total characters in a GET request, but the actual RFC for HTTP/1.1 has no limit for the protocol (RFC 2616 Section 3.2.1). And slightly off-topic, but think about how much the web has changed in the last 20 years (well, 17, since the HTTP protocol came about in 1990) and then think about the fact that it's all still based on nothing higher than version 1.1. On 5/3/07, *Neo [GC]* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Merlin schrieb: Hi there, I am checking plausability inside a php script that receives a POST submit. If an error occures the user should be redirected back, along with his original data filled into the forms. There is a problem with this. As the GET method, which the redirect is using, only allows a certain amount of characters, the text is always cut down. I use this: HEADER(Location:.$data[rurl].?error=.$error.$parameter); Is there a way to redirect the user to the form and fill in large text? Thank you for your help, Best regards, Merlin This is a normal behaviour. Webservers trim the GET-request at a certain length. You have several options: - don't do a redirect but return the form, with most clean frameworks it should be no problem to include the action wich generates the form - save the variables in a session, then send the redirect-header and clean the session after regenerating the form - save the variables in a cookie stored at the client and clean the cookie afterwards (ugly) Greetings, -- Thomas 'Neo' Weber Webmaster GothNet.eu | Gothic-Chat.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- Thomas 'Neo' Weber Webmaster GothNet.eu | Gothic-Chat.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php