praeto Posted October 29, 2007 Share Posted October 29, 2007 This code runs and plays a WAV file whenever someone loads my webcam page. I would also like to add 3-4 Buttons that when clicked would run the code to different wav files. (IE WAVE1.WAV or WAVE2.WAV e.t.c.) What am I missing??? (THE BELOW PLAYS ONLY 1 WAV HOWEVER ONLY WHEN PAGE LOADS) -------------------- <?php $runCommand = "sndrec32 /play /close C:\\Windows\\Media\\Notify.wav"; $WshShell = new COM("WScript.Shell"); $output = $WshShell->Exec($runCommand)->StdOut->ReadAll; echo "<p>$output</p>"; ?> I TRIED THE FOLLOWING SO USERS COULD CHOOSE WAV TO PLAY HOWEVER I CANT GET IT TO WORK ------------------------- <?php switch ($_GET['submit']) { case 'Button1': $runCommand = "sndrec32 /play /close C:\\Windows\\Media\\Notify.wav"; $WshShell = new COM("WScript.Shell"); $output = $WshShell->Exec($runCommand)->StdOut->ReadAll; echo "<p>$output</p>"; break; case 'Button2': $runCommand = "sndrec32 /play /close C:\\WAVS\\THIS.wav"; $WshShell = new COM("WScript.Shell"); $output = $WshShell->Exec($runCommand)->StdOut->ReadAll; echo "<p>$output</p>"; break; case 'Button3': $runCommand = "sndrec32 /play /close C:\\WAVS\\THAT.wav"; $WshShell = new COM("WScript.Shell"); $output = $WshShell->Exec($runCommand)->StdOut->ReadAll; echo "<p>$output</p>"; break; default: print ' <form> <input type="submit" name="submit" value="Button1" /> <input type="submit" name="submit" value="Button2" /> <input type="submit" name="submit" value="Button3" /> </form>'; break; } // End: switch ($_GET['submit']) ?> Quote Link to comment https://forums.phpfreaks.com/topic/75268-button-menu-to-run-event/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.