Re: GETS and POSTS and existing query strings

"Tuc at T-B-O-H.NET" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <200801280120.m0S1KHFN047216@himinbjorg.tucs-beachin-obx-house.com>
> On 1/16/08, Tuc at T-B-O-H.NET <[email protected]> wrote:
> >
> >         Which I get my data in the QUERY_STRING, and the other data via
> > the [POST] params.
> >
> >         Is there a way I can uniformly get what I need, regardless of a
> > GET or a POST?
> >
> 
> It sounds like you're trying to mix GET and POST.  I believe this is what
> you're looking for, from the CGI documentation:
> 
>        MIXING POST AND URL PARAMETERS
> 
>           $color = url_param('color');
> 
>        It is possible for a script to receive CGI parameters in the URL as
> well as in the fill-
>        out form by creating a form that POSTs to a URL containing a query
> string (a "?" mark fol<E2><80><90>
>        lowed by arguments).  The param() method will always return the
> contents of the POSTed
>        fill-out form, ignoring the URL's query string.  To retrieve URL
> parameters, call the
>        url_param() method.  Use it in the same way as param().  The main
> difference is that it
>        allows you to read the parameters, but not set them.
> 
>        Under no circumstances will the contents of the URL query string
> interfere with similarly-
>        named CGI parameters in POSTed forms.  If you try to mix a URL query
> string with a form
>        submitted with the GET method, the results will not be what you
> expect.
> 
> The last sentence is important as well, because you're providing the browser
> with a URL that has a query string, and asking it to submit a form with the
> GET method.  This will cause the browser to replace the existing query
> string with a new query string.
> 
> Have you considered using hidden input fields to pass your 'next' and 'sid'
> parameters?  That way they will be passed with the rest of the data.
> 
> David
> 
Hi,

	I wasn't trying to mix GET/POST on purpose. I was being forced
since I was trying to make sure my "next" and "sid" were there, be it a 
form, HREF, SRC, etc. I did end up "changing my ways". 

	I forgot that you can do something like :

	/cgi-bin/mycgi.pl/start_or_next/sid

	So now if there is a query string, I just get :

	/cgi-bin/mycgi.pl/start_or_next/sid?field=value

	so it solved my issue of POSTing with a URL query string OF MY OWN. 
So as they say, its "all good". :)

	As for inserting it into the form, I didn't want to try that on the
fly. I was having enough issues trying to parse/replace text in the pages
I got. I actually had to sort the data longest to shortest to make sure
that when I did my search/replace I didn't do a "sub replace" where it
shouldn't be. 

	I'd love to know if there is a way to call HTML::LinkExtor in a 
search/replace mode. If anyone knows, I'd be quite interested.

		Thanks, Tuc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.