I am building a lyric page, and i have a page that display artist name by a-z
page.php?letter=a
However, for the title, i have to use switch statement to change it
switch($letter)
{
case 'a':
$var = 'Artist A';
break;
case 'b':
$var = 'Artist B';
break;
case 'b':
$var = 'Artist C';
break;
}
and i try to use foreach to loop the 26 letters, but it is not work. Can anybody help, so i don't have to type 26 times of the switch statement
foreach(range('A','Z') as $_letter)
{
$letter = $_GET['letter'];
switch($letter)
{
case '$_letter':
$var = 'Artist $_letter';
break;
}
}
echo "$var";
echo "<br>";
echo "<br>";