我想在php中写这个想法

i want a input field where i can write in a number from 0 to 10. if i write number 10 the output must be 9,7,5,3,1 or if i would write the number 8 the output should be 7 5 3 1 So only the odd numbers must be outputted when clicked on submit after putting a number in the input form. html is combined with this php code i think. please help.

  <form action="#" method ="post">
<input type="text" name="number">
<input type="submit" name ="submit" value="submit">
</form>
<?php
if(isset($_POST['submit'])){
$number = $_POST['number'];
for($i=$number;$i>0;$i--){
  if($i%2 != 0 ) // modulo prueba por pares o impares
     echo $i.'<br>';
}
}

Please check above code

try this one

$inputNumber = intval($_POST[inputNumber"]);
for($i = $inputNumber ; $i >=1 ; $i--){
  if($i % 2 == 1){
    echo $i." ";
  }
}