note 14537 added to control-structures.switch.php
| From: | zachwhite at zachwhite dot com | Date: | Thu, 02 Aug 2001 23:44:42 +0000 |
| Subject: | note 14537 added to control-structures.switch.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16254@lists.php.net to get a copy of this message | ||
To make simple download script.
<?
switch($file) {
case "file1":
include('file1.zip');
break;
case "file2":
include('file2.zip');
break;
case "file3":
include('file3.zip');
break;
case "file4":
include('file4.zip');
break;
default:
include('downloads.php');
break;
}
?>
Name file file.php urls will look like file.php?file=file1 and it will download file1.zip. If you
just enter file.php it will display downloads.php
http://www.php.net/manual/en/control-structures.switch.php