I want odd numbers to come put pink and even to come out purple, but it won't work. It comes out as
5 * 6 = 30 Notice: Undefined variable: n in /htdocs/www/multi.php on line 16 ColorMeNumber30
<html>
<form action="multiply.php" method="POST">
<input type="text" name="num1">
<select name="operation">
<option>multiply</option>
</select>
<input type="text" name="num2">
<input type="submit" value="calculate">
</form>
</html>
<?php
$num1 = $_POST["num1"];
$num2 = $_POST["num2"];
$operation = $_POST["operation"];
if ($operation == "multiply")
{
$answer_multiply = $num1 * $num2;
echo $num1." * ".$num2." = ";
echo $answer_multiply;
}
if ($n % 2)
{
echo "<font color=pink>";
}
else
{
echo "<font color=purple>";
}
echo ("ColorMeNumber$answer_multiply");
echo "</font>";
?>
5 * 6 = 30 Notice: Undefined variable: n in /htdocs/www/multi.php on line 16 ColorMeNumber30
<html>
<form action="multiply.php" method="POST">
<input type="text" name="num1">
<select name="operation">
<option>multiply</option>
</select>
<input type="text" name="num2">
<input type="submit" value="calculate">
</form>
</html>
<?php
$num1 = $_POST["num1"];
$num2 = $_POST["num2"];
$operation = $_POST["operation"];
if ($operation == "multiply")
{
$answer_multiply = $num1 * $num2;
echo $num1." * ".$num2." = ";
echo $answer_multiply;
}
if ($n % 2)
{
echo "<font color=pink>";
}
else
{
echo "<font color=purple>";
}
echo ("ColorMeNumber$answer_multiply");
echo "</font>";
?>