Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

(PHP Button) So simple yet so complicated?!? Please help

$
0
0

Hello everyone, I am currently coding what I thought would be a simple PHP button that would alternate each time you click it to provide a different action. I've spent almost 2 hours trying to figure this out but I'm stumped at this point. I need your help.. Here is what I have so far:

 

the PHP:

<?php
session_start();


$pause = 1;
$btnname = "Pause";
$btntype = "pause";


if (isset($_POST['button'])) {

if (isset($pause)) {
unset($pause, $btnname, $btntype);
$play = 1;
$btnname = "Play";
$btntype = "play"; 

} else if (isset($play)) {
unset($play, $btnname, $btntype);
$pause = 1;
$btnname = "Pause"; 
$btntype = "pause"; 

}

?>

The HTML:

<a href="#" onclick="var myPlayer = document.getElementById('playerid'); myPlayer.<?php echo $btntype; ?>Video();"><input name="button" type="submit" id="button" value="<?php echo $btnname; ?>" /></a>

The Goal is to simple create a button where it will alternate between a "Play" and "Pause" command.

 


Viewing all articles
Browse latest Browse all 13200

Trending Articles