A simple php file was edited in /var/www/html/tmp/test.php.
nmap <F12>f :!firefox 'http://127.0.0.1/tmp/%'<CR>
I can see at least a couple of things wrong.
One, the mapping you wrote is <F12>f which would be F12 and then the letter F.
Two, % expands the relative path to the file, in this case
/var/www/html/tmp/test.php as you're executing vim from the home directory. The expansion you're looking for is actually