Huggies12345
New member
Hi,
I am really stuck on this.
I have a texbox and a submit button, when the user types a number into this textbox and presses enter the variable ($x) will store that value.
Now when that same submit button is pressed i want another textbox to show whether that number is odd or even.
Here is the code for that:
<?php
$x = $_GET['variable'];
echo '<input type ="text" name="output" value=""';
if ($x % 2 == 0){
echo "Even";
}else{
echo"Odd";
}
echo ' />';
?>
When i press the submit button with a number in it nothing happens at all.
How do i get it so that "Even" or "Odd" is displayed in the "output" textbox?
Thanks.
I am really stuck on this.
I have a texbox and a submit button, when the user types a number into this textbox and presses enter the variable ($x) will store that value.
Now when that same submit button is pressed i want another textbox to show whether that number is odd or even.
Here is the code for that:
<?php
$x = $_GET['variable'];
echo '<input type ="text" name="output" value=""';
if ($x % 2 == 0){
echo "Even";
}else{
echo"Odd";
}
echo ' />';
?>
When i press the submit button with a number in it nothing happens at all.
How do i get it so that "Even" or "Odd" is displayed in the "output" textbox?
Thanks.