Hi,
I am trying to make a script so i can view multi pages in 1 cgi file. i have come with the following.
print( "Content-type: text/html\n\n" ) ;
@pairs = split( /&/, $ENV{ 'QUERY_STRING' } ) ;
foreach $pair ( @pairs ){
( $name, $value ) = split( /=/, $pair ) ;
$value =~ tr/+/ / ;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack( "C", hex( $1 ) )/eg ;
$QS{ $name } = $value ;
}
if( $QS{ 'PageNum' } eq "one" ){
$html = qq|
<html>
<head>
<title>Page One</title>
</head>
<body>
<h2>Page One</h2>
<a href="pageinpage.cgi?PageNum=two">Two</a>
</body>
</html>
| ;
}elsif( $QS{ 'PageNum' } eq "two" ){
$html = qq|
<html>
<head>
<title>Page Two</title>
</head>
<body>
<h2>Page Two</h2>
<a href="pageinpage.cgi?PageNum=one">One</a>
</body>
</html>
| ;
}else{
$html = qq|
<html>
<head>
<title>Page Nothing</title>
</head>
<body>
<h2>Page Nothing</h2>
<a href="pageinpage.cgi?PageNum=one">One</a><br>
<a href="pageinpage.cgi?PageNum=two">Two</a><br>
</body>
</html>
| ;
}
print( $html ) ;But when I put a form field it messes up the query string and I can't think of anyother way of getting the forms without bothering the query string.
Thank You,
Kurt
I am trying to make a script so i can view multi pages in 1 cgi file. i have come with the following.
Code:
#!/usr/bin/perl print( "Content-type: text/html\n\n" ) ;
@pairs = split( /&/, $ENV{ 'QUERY_STRING' } ) ;
foreach $pair ( @pairs ){
( $name, $value ) = split( /=/, $pair ) ;
$value =~ tr/+/ / ;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack( "C", hex( $1 ) )/eg ;
$QS{ $name } = $value ;
}
if( $QS{ 'PageNum' } eq "one" ){
$html = qq|
<html>
<head>
<title>Page One</title>
</head>
<body>
<h2>Page One</h2>
<a href="pageinpage.cgi?PageNum=two">Two</a>
</body>
</html>
| ;
}elsif( $QS{ 'PageNum' } eq "two" ){
$html = qq|
<html>
<head>
<title>Page Two</title>
</head>
<body>
<h2>Page Two</h2>
<a href="pageinpage.cgi?PageNum=one">One</a>
</body>
</html>
| ;
}else{
$html = qq|
<html>
<head>
<title>Page Nothing</title>
</head>
<body>
<h2>Page Nothing</h2>
<a href="pageinpage.cgi?PageNum=one">One</a><br>
<a href="pageinpage.cgi?PageNum=two">Two</a><br>
</body>
</html>
| ;
}
print( $html ) ;
Thank You,
Kurt