is_numeric issue
Posted: Tue Jan 22, 2008 7:29 am
The following script never runs the 'else' part of the code, but I don't understand why. Any thoughts appreciated.
if(is_numeric($mortgage))
{
$table =
"
<table width='100%' border='0' cellpadding='1'>
<tr>
<td class='warning'><div align='center'>That's a number!</div></td>
</tr>
</table>
";
} else {
$table =
"
<table width='100%' border='0' cellpadding='1'>
<tr>
<td class='warning'><div align='center'>Mortgage number field must contain numbers ONLY</div></td>
</tr>
</table>
";
}
if(is_numeric($mortgage))
{
$table =
"
<table width='100%' border='0' cellpadding='1'>
<tr>
<td class='warning'><div align='center'>That's a number!</div></td>
</tr>
</table>
";
} else {
$table =
"
<table width='100%' border='0' cellpadding='1'>
<tr>
<td class='warning'><div align='center'>Mortgage number field must contain numbers ONLY</div></td>
</tr>
</table>
";
}