This question already has an answer here:
- Reference - What does this error mean in PHP? 34 answers
- PHP parse/syntax errors; and how to solve them? 17 answers
I am new to php. So I simply translated my java code to php.
It says
Parse error: syntax error, unexpected 'counter' (T_STRING) in D:\files\xampp\htdocs\try.php on line 15.
Here is my code:
<form action="" method = "POST">
Enter the first number: <input type="number" name="FirstNum" required><br><br>
<input type = "submit" value = "Enter"/>
</form>
<?php
int counter = 0;
while (counter < 1) {
switch($_POST['FirstNum'])
{
case "1":
echo "Addition";
counter++; break;
case "2":
echo "Subtraction";
counter++; break;
case "3":
echo "Multiplication";
counter++; break;
case "4":
echo "Division";
counter++; break;
default:
echo "Invalid Operation";
}
}
?>
</div>