The main problem is that you are using
$query = "select DISTINCT artist
from MUSIC where substring(artist,1,1) = '$FirstLetter'";
but $FirstLetter is not set anywhere. if you add this line
$FirstLetter = $_GET['catid'];
before the query, this will ensure that the letter is picked up from the URL parameter (e.g. ?catid=A would yield $FirstLetter = 'A').
Note that for production code there are a number of issues to consider:
You should validate all user input (I haven't in my simple example)
You should check errors after all database queries
functions that you use in both pages should be included in from a common file
but I have just focused on what you need to get the code working.