Skip to content

Instantly share code, notes, and snippets.

@jameshibbard
Last active December 15, 2015 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameshibbard/5344406 to your computer and use it in GitHub Desktop.
Save jameshibbard/5344406 to your computer and use it in GitHub Desktop.
Form for simple AJAX unit converter
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>AJAX unit Converter</title>
<style>
#myForm div{margin-bottom:15px;}
#result{border:solid 1px green; background: #6F9; margin-top:25px; padding:7px; display:none;}
</style>
</head>
<body>
<h1>Digital Storage Converter</h1>
<form action="convert.php" method="post" id="myForm">
<div>
<label for="amount">Amount:</label>
<input type="text" id="amount" name="amount" />
</div>
<div>
<label for="from">From:</label>
<select name="from" id="from">
<option value="0" selected="selected">Select unit</option>
<option value="1">kilobytes</option>
<option value="2">megabytes</option>
<option value="3">gigabytes</option>
<option value="4">terabytes</option>
<option value="5">petabytes</option>
<option value="6">exabytes</option>
</select>
<label for="into">Into:</label>
<select name="into" id="into">
<option value="0" selected="selected">Select unit</option>
<option value="1">kilobytes</option>
<option value="2">megabytes</option>
<option value="3">gigabytes</option>
<option value="4">terabytes</option>
<option value="5">petabytes</option>
<option value="6">exabytes</option>
</select>
</div>
<input type="submit" value="Convert">
</form>
<p id="result"></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment