Problems with a null value in PHP and HTML?

The Pc guy

New member
I am doing a project, in which I have an HTML page, and the user types in a name and an age (can insert up to 10) and I wish to display the values where the variable "age1" "age2" ect to "age10" are not null.
I currently have the following but the variable seems not to be set to null, even if i leave the age box blank (in the HTML page) which makes me wonder what is doing this.

if ($age1 != null)
the idea behind this line is as follows, in plain english;
If age1 (the age variable) is not equal to null (if it is anything other than a null)
and then i have it say
Print true.
However, it prints true no matter whether I leave the box blank or not.

In the HTML page, the box is inserted with the following code;
<input type = "text" name = "Age1" size = "8" />

and on the php page I have the following code;
$age1 = $_POST['Age1'];

Is there something I have done wrong that may lead to the age1 variable being anything other than a null?
@delsol
Thankyou, but as this is an age thing, will I still be able to use the 0?
 
Back
Top