On Monday, March 25, 2002, at 09:31 AM, ...::: Rober2.com :::... wrote:
> What's really the meaning with
> whatever.php?page=1 when you are NOT using a db?
> Just cuz it looks cool? Or is there a better reason?
>
> -Cuz you could do <a href="whatever.htm"> instead of blabla.php?page=1
> (having include('blabla.htm'); in a script in blabla.php...of course)
You can pass $_GET variables in this way, which become available on the
next page. Here's an example:
http://domain.com/whatever.php?theme=metallic
Now in the whatever.php script, if there is code like this:
// determine user's theme preferences
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"";
if ($_GET['theme']) {
switch $_GET['theme'] {
case 'sky':
print 'sky.css';
case 'metallic':
print 'metallic.css';
default:
print 'standard.css';
}
} else {
print 'standard.css';
}
print "\" />"; // finish the <link> tag
Obviously, you wouldn't really use a theme in this fashion since you'd
have to replicate this value in every link in your document -- this kind
of thing is more appropriate to have in a session variable. But the
lesson is the same -- variables can be passed in this fashion for any
purpose, not just database access. (It's called "passing a variable in
the querystring".)
HTH,
Erik
----
Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php