I have a button that when clicks plays a song. What I am trying to do is when the button is clicked an images displays "now playing" while the song plays and then the page reloads when finished.
What is happening is that when the button is click the song plays and then the image displays "now playing" as the page reloads.
How can I get it to display the "now playing" graphic before playing the song?
The code
<?php
if (isset($_POST['PlaySong']))
{
echo ("<img src='/images/nowplaying.png'>");
exec ("/usr/bin/sudo /home/pi/scripts/song.sh");
header ('Location: '.$_SERVER['REQUEST_URI']);
?>