Forum Moderators: coopster & phranque

Message Too Old, No Replies

Multiple Query_Strings!

         

WobMaster

5:38 pm on Jan 4, 2004 (gmt 0)

10+ Year Member



Dear Friends!

I want to know that how to do this?:

with Normal $ENV{'QUERY_STRING'} we can show only 1 thing!
like page.cgi?Hello

so, it will Display Hello!

But i want to show 2 things

like page.cgi?name=Brett&age=18

so, how it will display that:

Your Name is: Brett

and Age is: 18?

Please Help,.. i m stukk in this!

xunker

1:40 am on Jan 5, 2004 (gmt 0)

10+ Year Member



Try using the "CGI" module, it will help with automatically handling things like this. Something like this:

use CGI;
$query = new CGI;

$name = $query->param ('name');
$age = $query->param ('age');

print "You are $name and you are $age years old";

WobMaster

4:27 am on Jan 5, 2004 (gmt 0)

10+ Year Member



Thanks allot!

But 1 more Problem its working but at the top its showing error like:::


CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
You are Rock and you are 18 years old

Please help at once!

xunker

9:49 am on Jan 5, 2004 (gmt 0)

10+ Year Member



..the problem is you're not returning headers :)

try using "print $query->header ();" before you print anything else, then print the rest of the text you want.

WobMaster

11:02 am on Jan 5, 2004 (gmt 0)

10+ Year Member



Thankssssssssssss!

It Got Working :))))

volatilegx

5:32 pm on Jan 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



or you could just do this:

print "Content-type: text/html\n\n";

before you print anything else. It's the same thing... but at least you know exactly what header is being used.