Hej, zaczynam naukę PHP i trafiłem na to forum. Mam problem z rozwiązaniem zadania z użyciem pętli. Oblicza sumę dwóch liczb podanych przez użytkownika. Algorytm ma działać tak długo, aż suma podanych liczb będzie wynosiła 0.
<?php
$number1 = $_POST['number1'];
$number2 = $_POST['number2'];
for($i = 0; $i; $i++){
if($number1 + $number2 == 0){
echo "The result is: 0";
break;
}else{
include 'form.html';
}
}
<html>
<form action="script.php" method="post">
<label for="number1">Number 1:</label>
<input type="text" name="number1">
<label for="number2">Number 2:</label>
<input type="text" name="number2">
<input type="submit" value="Check">
</form>
</html>
Co robię nie tak?