Skip to content

Instantly share code, notes, and snippets.

@darrenjaworski
Last active December 16, 2015 15:39
Show Gist options
  • Save darrenjaworski/5457705 to your computer and use it in GitHub Desktop.
Save darrenjaworski/5457705 to your computer and use it in GitHub Desktop.
Textbook Inventory - PHP

This is a simple implementation of a textbook inventory program in PHP from C# - PHP file

<!DOCTYPE html>
<html>
<head>
<style>
body {
padding: auto;
margin: auto;
width: 1000px;
margin-top: 10px;
}
</style>
</head>
<body>
<?php
$NoCartons = $_POST['NoCartons'];
$NoBooks = $_POST['NoBooks'];
$Value = $_POST['Value'];
$TotalBooks = $NoCartons * $NoBooks;
$TotalValue = $TotalBooks * $Value;
echo "Number of cartons " . $_POST["NoCartons"] . ".<br>";
echo "Number of books " . $_POST["NoBooks"] . ".<br>";
echo "Total number of books = " . $TotalBooks . ".<br>";
echo "Total value of inventory = $" . $TotalValue . ".<br>";
?>
<br>
<form action="textbookinventory.html">
<ul>
<li><input type="submit" value="reinput values">
</li>
</ul>
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
body {
padding: auto;
margin: auto;
width: 1000px;
margin-top: 10px;
}
</style>
</head>
<body>
<fieldset>
<form action="txbookcompute.php" method="post">
<legend>Text Book Inventory</legend>
<ul>
<label>Enter the number of cartons:</label><br>
<li><input type="number" name="NoCartons" min="0" required>
</li>
<label>Enter the number of books per carton:</label><br>
<li><input type="number" name="NoBooks" min="0" required>
</li>
<label>Enter the value per book in carton:</label><br>
<li><input type="number" name="Value" min="0" required>
</li>
<br>
<br>
<li><input type="submit" name="compute" value="compute">
</li>
</ul>
</form>
</fieldset>
<!--<fieldset>
<form>
<legend>Compute</legend>
<ul>
<li><input type="submit" name="txbookcompute.php" value="compute">
</li>
</ul>
</form>
</fieldset>-->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment