timgolding
07-02-2007, 03:31 PM
I am trying to validate a float. I need to test if a string variable is a float. i tried the is_float function but it doesnt seem to work with string variables
$duration=$_POST['duration'];
if(!is_float($duration))
{
die ('<div style="clear:both;float:left;"><h3>Sorry your duration must be a number in hours.</h3>
<table><tr><td>Click here to go back -</td><td> <a href="?area=1" class="button" >Back </a></td></tr></table></div></div>');
}
$duration=$_POST['duration'];
if(!is_float($duration))
{
die ('<div style="clear:both;float:left;"><h3>Sorry your duration must be a number in hours.</h3>
<table><tr><td>Click here to go back -</td><td> <a href="?area=1" class="button" >Back </a></td></tr></table></div></div>');
}