Nesting Control Structures?
Posted: Mon Sep 14, 2009 6:58 pm
Hi I am basically brand new to php. Right now, I'm trying to create a script that
1. assigns some information inputted by the user to a variable
2. Checks to see if it is a string
3. If it is a string it prompts the user to input a number
4. if it is a number, it performs a counting algorithm
I think i made a mistake with the control structures. Either I'm nesting them wrong or I'm using the wrong ones.
Please check out my code, thanks.
1. assigns some information inputted by the user to a variable
2. Checks to see if it is a string
3. If it is a string it prompts the user to input a number
4. if it is a number, it performs a counting algorithm
I think i made a mistake with the control structures. Either I'm nesting them wrong or I'm using the wrong ones.
Please check out my code, thanks.
Code: Select all
<?php
$count = $_POST['count'];
if (is_string($count)
{
echo "That is not a number!";
}
else
{
while ($count <=1000)
{
echo "$count <br />";
$count = $count *(-2);
}
}
?>