Hello again.
If one is using php to do a set of calculations that sometimes encounters Null inputs...how does one get Null to output rather than a zero?
For example, say a mess of reading and error scores are being entered, and the Words Read - Errors = Words Correct.
Sometimes the Words Read and Errors fields will be blank because the kid was not tested. The correct Words Correct score should be Null rather than zero.
Why enter it at all? Here's why...
The form that shoots this data into the MySQL is build to enter a bunch of scores for a kid tested at a certain point in time. (ie. not just the Reading, but Math and Writing as well. So sometimes some of the tests are omitted for sundry reasons...but the form is still used to enter the other data.
Here is the portion of the POST form that is used to pass the values to the script upon submit (this is a data editor page...the initial values in the boxes come from a query. If the user needs to, they can be edited at this point):
echo "<tr><th align=\"center\" colspan=\"2\">READING PROBE 1</th></tr>";
echo "<tr><th align=\"right\">Words Read/1 min.</th><td><input type=\"text\" name=ORF1WR size=\"5\" value=$Row[ORF1WR]></td></tr>";
echo "<tr><th align=\"right\">Errors</th><td><input type=\"text\" name=ORF1ERR size=\"5\" value=$Row[ORF1ERR]></td></tr>";
echo "<tr><th align=\"right\">Words Read Correctly</th><td>(Recalculated on submit)</td></tr>";
I simultaneously pass the reading data and do the calculation in the Insert script page like so...
$ORF1WRC = $HTTP_POST_VARS['ORF1WR']-$HTTP_POST_VARS['ORF1ERR'];
but when I check the value of $ORF1WRC later, it is always zero when the WR and ERR scores are Null (at least I think they're null at that point unless I'm doing something wrong in the POST form.)
Suggestions welcome! Arrrgh!