PHP Calculator
Posted: Mon May 23, 2005 10:07 am
I'm trying to make a calculator for a specific purpose, and so far I can't find any examples I can modify to work the way I want it to. Hopefully someone here can figure out what's wrong with it.
Here's the HTML form that goes with it.
Here's the PHP code that I got so far.
I'm kinda new to php, so that probably looks pretty messed up, but all I need is to get it working. Thanks for any help ya'll give me.
Here's the HTML form that goes with it.
Code: Select all
<html>
<head>
<title>Calculator</title>
</head>
<body>
<form name="e;calc"e; method=POST action="e;calc.php"e;>
Number of Ships:
<input name="e;ships"e; type="e;text"e; maxlength="e;3"e;><p>
Number of Weapons Fired:
<input name="e;fired"e; type="e;text"e; maxlength="e;3"e;><p>
Type of Weapon:
<select name="e;weapon"e;>
<option value="e;25"e;>Laser</option>
<option value="e;15"e;>Nuclear Missile</option>
*There's a bunch of values in here that I edited out for length*
<option value="e;100"e;>Homing Black Hole</option>
<option value="e;100"e;>Distortion Blaster</option>
</select>
<input type="e;submit"e; name="e;Submit"e; value="e;Submit"e;>
</form>
</body>
</html>Code: Select all
<html>
<head>
<title>
<?php
echo "</title>";
echo "</head>";
echo '<body>';
// global variables
$valid_form = "false";
$ships = ""; // ships
$fired = ""; // fired
$weapon = ""; // weapon
&fired * weapon / &ships = &type;
echo &type;
?>
</body>
</html>