Here's the code.
<!DOCTYPE html>
<html>
<head><title>Numbers</title></head>
<body>
<form action="index.php" method="get">
<b>Numbers</b>
<br>
<textarea rows="12" cols="25" name="result" value="result"></textarea>
<br>
<input type="submit" value="Submit" name="submit">
</form>
</body>
</html>
<?php
$result=$_GET["result"];
if (empty($_GET['result']))
{
echo '<p><font size="3" color="red">Field is Empty*</font></p>';
}
elseif (isset($_GET['result']))
{
$result=(explode("
", $result));
}
{
echo count ($result);
echo "<br />";
echo array_sum($result);
}
?>
Ok so I figured out how to get most of my assignment's tasks and the last 1 that I am stuck with is using similar codes such as filter_var to print out non-numerical values that are submitted. Ex. a b c * & ! @
PRINTING any invalid inputs that aren't numbers. Ex. Letters, symbols.
Any suggestions?