Code: Select all
<!DOCTYPE html>
<html>
<head>
<meta content="en-us" http-equiv="Content-Language">
<meta charset="utf-8">
<title>Freakout Test</title>
<script src="soundmanager2-nodebug-jsmin.js"></script>
<script>soundManager.setup({url:'swf',onready:function(){var mySound=soundManager.createSound({id:'aSound',url:'flustered.mp3',autoLoad:true,autoPlay:false});}});</script>
<style type="text/css">
div, p {text-align: center;}
.redclass {outline: thin red solid;}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!-- hide from none JavaScript Browsers
Image1= new Image(95,95)
Image1.src = "freakout.gif"
Image2 = new Image(95,95)
Image2.src = "freakout-resting.gif"
// End Hiding -->
</SCRIPT>
</head>
<body>
<?php
$cluck = "<script>soundManager.setup({url:'swf',onready:function(){var mySound=soundManager.createSound({id:'aSound',url:'flustered.mp3'});mySound.play();}});</script>";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$errorsfound = 0;
if (empty($_POST['firstinput'])) {$errorsfound = 1; }
}
?>
<form method="post">
<p> </p>
<p style="color:red;">* All fields are required</p>
<div>
<span>Enter something:</span> <input name="firstinput" <?php echo ($errorsfound > 0) ? 'class="redclass"' : '' ?> > <input type="submit" value="Submit"></div>
<div>
<?php echo ($errorsfound > 0) ? $cluck : ''?>
<img alt="" height="95" width="95" src=<?php echo ($errorsfound > 0) ? '"freakout.gif?='.rand(1,32000).'"' : '"freakout-resting.gif"'?>></div>
<p> </p>
<div style="text-align:center;">
If you press 'submit' with the field left empty the chicken will point out your mistake.
</form>
</body>
</html>
Yours to use if you like it.
December 5, 2014: added sound. You can have the sound too: http://lloydsplace.com/flustered.mp3



