[ic] form post vs query string

Mike Heins mike at perusion.com
Wed Nov 19 13:21:34 EST 2003

Quoting Marc Brevoort (marc.brevoort at armazemdedados.com):
> Hi,
> The CGI tag gives me both posted variables and variables specified in 
> the query string of the URL.
> I have a situation where it would be useful to be able to distinguish 
> between them, is it possible to read variables only from either the set 
> of posted form variables or the variables specified in the query string?

No, no way to do that, they are identical.

You can get access to the QUERY_STRING, though, in a UserTag, and
posit this.

UserTag is_from_query Order name
UserTag is_from_query Routine <<EOR
sub {
	my $name = shift;
	my $re = qr/^$name=/;
	my @pairs = split($Global::UrlSplittor, $CGI::query_string);
	for(@pairs) {
		next unless $_ =~ $re;
		return 1;
	return 0;

At that point, you can do:

	[if term="[is_from_query foo]"]
		From query.

Of course if it is set multiple times, once in the query string
and once in the post, it will give a false positive.

Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295      <mike at perusion.com>

Few blame themselves until they have exhausted all other possibilities.
 -- anonymous

More information about the interchange-users mailing list