我有一个页面,play.html
:
<form method="post" action="play.php">
<input type="hidden" name="mp3name" value="/MP3/1.mp3">
<input type="submit" value="Play My MP# #1" />
</form>
<form method="post" action="play.php">
<input type="hidden" name="mp3name" value="/MP3/2.mp3">
<input type="submit" value="Play My MP# #2" />
</form>
这会调用另一个页面play.php
:
<?php
$formurl = "play.html" ;
$playerurl = "player.html" ;
$mymp3 = $_GET["mp3name"];
header( "Location: $playerurl?mp3name=$mymp3" );
exit ;
?>
然后它调用另一个页面,player.html
:
<audio id="player" src="$mymp3" autoplay preload="auto"> </audio>
<div>
<button onclick="document.getElementById('player').play()">Play</button>
<button onclick="document.getElementById('player').pause()">Pause</button>
<button onclick="document.getElementById('player').volume+=0.1">Volume Up</button>
<button onclick="document.getElementById('player').volume-=0.1">Volume Down</button>
</div>
如何将变量从 PHP 传递到player.html
?