Skip to content

Instantly share code, notes, and snippets.

@magmastonealex
Created October 3, 2013 20:31
Show Gist options
  • Save magmastonealex/6816644 to your computer and use it in GitHub Desktop.
Save magmastonealex/6816644 to your computer and use it in GitHub Desktop.
<?php
$n = 0;
if(isset($_GET["n"])){
$n = $_GET["n"];
}
$r = 0;
if($n != 0){
for($i=1;$i<=$n;$i++){
$r = $r + pow($i, 2);
}
}
?>
<html>
<head>
<title>1summer</title>
</head>
<body>
<form action="a1q5.php" method="GET">
<input type="text" name="n" id="n">
<input type="submit" value="Submit">
</form>
<br>
<b>
<?php
if($r != 0){
echo "Result is: $r";
}
?>
</b>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment