<html> <body> <?php $a = $_GET["attack"]; $d = $_GET["defence"]; $attacker = (($d / $a)^1.5])); $defender = (($a / $d)^1.5]); ?> <br> Simple Battle Calculator<br><br> Attack HP: <?php echo $_GET["attack"]; ?><br> Attack HP:<?php echo $_GET["defence"]; ?><br><br><br> "><?php if ( $defender >= 100 ) {echo "Attacker wins.";} else { echo "Defender wins.";} ?><br> <p>Attacker ship loss: <span style="color:red"><?php if ($attacker >= 100 ) {echo "100";} else { echo $attacker;} ?></span>%<br> <br><br> Defender ship loss: <span style="color:red"><?php if ( $defender >= 100 ) {echo "100";} else { echo $defender;} ?></span>% <br> include "menu2.php"; ?> </body> </html>
<pre lang="xml"><!DOCTYPE HTML> <html> <head> <style> .error {color: #FF0000;} </style> </head> <body> <form method="get" action="battle.php"> Attack HP:<input type="text" name="attack" value="<?php echo $attack;?>"><br><br> Defence HP:<input type="text" name="defence" value="<?php echo $defence;?>"><br><br> <input type="submit" name="submit" value="Submit"> </form><br><br><p></a> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)