<?php
$n = $_GET['N'];
$Q = 0;
for($k=0; $k<=$n; $k++)
{
$Q = (pow(-1,$k)*($k-7));
}
echo $Q;
?>
<html>
<head>
<title>PHP</title>
</head>
<body>
<form action="<?php $_PHP_SELF?>" method="GET">
N:<input type="text" name="N"/><br />
<input type="button" name="submit" value="Result!" />
</form>
</body>
</html>