Jump to content

Buddski

Members
  • Posts

    1,236
  • Joined

  • Last visited

Everything posted by Buddski

  1. You need to merge your code with what has been provided... <?php // FUNCTIONS // function area($a,$b) { return $a*$b; } function perimeter($a,$b) { echo "Length: " . $a . "<br/>"; echo "Width : " . $b . "<br/>"; echo "Perimeter: " . (2 * ($a + $b)) . "<br/>"; echo "Area : " . area($a,$b); return; } ?> <html> <body> <h1>PHP-sida 4</h1> <form action="php4.php" method="post"> <p>Längd: <input type="text" name="length" size="20" /></p> <p>Bredd: <input type="text" name="width" size="20" /></p> <p><input type="submit" value="CALCULATE" name="calc" /></p> </form> <?php if (isset($_POST['calc']) && !empty($_POST['length']) && !empty($_POST['width'])) { echo 'Processing...<br/>'; echo perimeter($_POST['length'],$_POST['width']); } else { echo 'You need to specify a length and a width.'; } ?> </body> </html>
  2. From what I understand.. litebearer has hit the nail right on the head. Does exactly as specified.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.