Null value
Posted: Wed Jan 13, 2010 8:11 am
How can i detect if a field is null? I try the is_nukk function but it seems doesn't work. Please review the following code:
<html>
<?php
if(!isset($_POST['Idade'])){
print "Valor zero";
}
if(is_null($_POST['Idade'])){
print "Tá branco";
}
?>
<form action="isset.php" method="post">
<p>Idade:<input type="text" name="Idade" value="" /></p>
<p>Valor:<input type="text" name="Valor" value="" /></p>
<p><input type="submit" value="Enviar!" /></p>
</form>
</html>
<html>
<?php
if(!isset($_POST['Idade'])){
print "Valor zero";
}
if(is_null($_POST['Idade'])){
print "Tá branco";
}
?>
<form action="isset.php" method="post">
<p>Idade:<input type="text" name="Idade" value="" /></p>
<p>Valor:<input type="text" name="Valor" value="" /></p>
<p><input type="submit" value="Enviar!" /></p>
</form>
</html>