Jump to content

Barry2014

New Members
  • Posts

    4
  • Joined

  • Last visited

Barry2014's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. <?php $xb = 4; //width $yb = 2; //length function rectangle($x, $y) { $a = $x * $y; return $a; } ?> <br/> Please enter the values of the length and width of your rectangle. <br/><br/> <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> Width: <input type="text" name="" id="" value="2"> <br/><br/> Length: <input type="text" name="" id="" value="4"> <br/><br/> <input type="submit" name="submit" value="submit"> </form> <?php echo $rectangle; ?> I need to output the answer 8 when a user click on submit
  2. Thanks, I use open brackets to start the string and it still work but what is best practice. You - echo "$x+$y = " . ($x+$y); // Output me - echo ("$x+$y = " . ($x+$y)); // Output
  3. <?PHP $x="10"; //Variable $y="7"; //Variable echo("$x+$y = 17") // Output ?> How do I get the correct answer to output without putting it in myself like how I did?
×
×
  • 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.