Jump to content

Button change? quick help


flip

Recommended Posts

Im trying to make a quick script containing ONLY html/php.. All I want it to do is change the text on the button once it's clicked. Here's my code:

 

<?php
if(isset($_POST['button'])){
  $a = "STOP";
}
else{
  $a = "GO";
  }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form method="post" action="#">
<input type="button" name="button" id="button" value="<?php print $a; ?>" />
</form>
</body>
</html>

 

any ideas why this isnt working?

Link to comment
https://forums.phpfreaks.com/topic/161825-button-change-quick-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.