Jump to content

Button Menu to run event


praeto

Recommended Posts

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']) 
?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.