First thing! Edit your question to include the actual text of your code - you can use markdown to format it correctly. This will make it easier for other people to read and copy / paste your code, which makes it easier for them to help you.
Second thing! Use variable names that describe the purpose of a value, not just it’s type. $Float
is no good as it doesn’t tell you what the variable is for. $multiples_of
would be better.
Third thing! Use a consistent coding style. You’ve capitalised $Float
but left $integer
all lower case; this will trip you up in larger scripts, so it’s better to get into a habit now. $snake_case
and $camelCase
are two popular options. You should also make sure your indentations are consistent; try and vertically match up the lines that open and close blocks in your code:
// This looks weird - it's difficult to easily see what's doing what
while ($x == 0) {
if ($integer <= 0){
break;
}
}
// This is more clear
while ($x == 0) {
if ($integer <= 0) {
break;
}
}
Fourth thing! When echoing a variable on its own, you don’t need to surround it with quotes.
// Will work, but unneeded
echo "$result";
// Will work, and cleaner
echo $result;
As for your actual problem… For each number between one and the user’s submitted multiplier, you want to print the product of that number and the user’s submitted base. You can do this like so:
$end_multiplier = (float) $_POST['num'];
$base = (int) $_POST['amt'];
for ($multiplier = 1; $multiplier <= $end_multiplier; $multiplier ++) {
echo $multiplier * $base, '<br>';
}