UBB.Dev
Posted By: v0id emotion help with php - 12/19/2001 9:12 PM
I didnt know where to put this, so im putting it here.

Anyway can someone make a template webpage for me on how to make something like index.php?section=misc or something along those lines, if you could, id be grateful.
Posted By: BloggerMan Re: help with php - 12/20/2001 7:26 AM
Not sure about PHP, but CGI would look like this:

=======================
#!/usr/bin/perl

if ($ENV{QUERY_STRING} eq page=section) { page2() };

print "Content-type:text/htmlnn";
print<Main page goes here.
page1
exit;

sub page2 {
print "Content-type:text/htmlnn";
print<Content for "Section" page goes here.
page2
exit;
}
=======================

Basically, this line of code:
if ($ENV{QUERY_STRING} eq page=section) { page2() };
is saying, "If the query string (everything after the "?" in the URL) equals "page=section", than display Subroutine "page2".

And then below that, the main page (page1) is just what is displays with nothing in the query string, and then sub page2 is what will be displayed if they have http://www.url.com/cgi-bin/mywebsite.cgi?page=section .

Sorry if that's not what you're looking for.
Posted By: Burak Re: help with php - 12/20/2001 11:55 AM
moving to `Server Side Scripting` Forum...
© UBB.Developers