You could, I suppose, but it would be a lot of code. A better way would be something like this:
PHP Code:
$names = array();
$urls = array();
$names[] = "BOB"; $urls[] = "bob.html";
$names[] = "BILL"; $urls[] = "bill.html";
$names[] = "BART"; $urls[] = "bart.html";
$page = array_search($name, $names);
if($page == false){
$page = "Somthing.html"; // <--Back to the form, or a not found page
}else{
$page = $urls[$page];
}
It's MUCH smaller then a case for each name. You could also pull the array out of another file, if you ever needed to. It gives you many more options.
EDIT: Oh, or the easier solution:
PHP Code:
$names = array();
$names[] = "BOB";
$names[] = "BILL";
$names[] = "BART";
$page = array_search($name, $names);
if($page == false){
$page = "Somthing.html"; // <--Back to the form, or a not found page
}else{
$page = $names[$page].'html';
}
Bookmarks