tbetter grammar in error message - cosmo - front and backend for Markov-Chain Monte Carlo inversion of cosmogenic nuclide concentrations
 (HTM) git clone git://src.adamsgaard.dk/cosmo
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit bcf49cd4344fed7ebb260868589c08208772486a
 (DIR) parent 18ddcf894fc1a9011f68410e7498fad52c7e8a53
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Tue, 18 Aug 2015 13:14:25 +0200
       
       better grammar in error message
       
       Diffstat:
         M uploadhistory.php                   |      10 ++++++++--
       
       1 file changed, 8 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/uploadhistory.php b/uploadhistory.php
       t@@ -27,10 +27,16 @@ if (!isset($_POST['long']) || $_POST['long'] == '') {
        // If something is missing, send error to user and make him/her go back
        if (count($missing_fields) > 0) {
            $error_msg = '<html><body>' .
       -        '<h2>Invalid input</h2>' .
       -        '<p>The following values are missing: <b>';
       +        '<h2>Invalid input</h2>';
       +
            // generate comma-separated list of missing field names
            for ($i = 0; $i < count($missing_fields); $i++) {
       +        if ($i == 0 && count($missing_fields) == 1) {
       +            $error_msg .= '<p>The following value is missing: <b>';
       +        } elseif ($i == 0) {
       +            $error_msg .= '<p>The following values are missing: <b>';
       +        }
       +
                if (1 == count($missing_fields)) { // just a single missing field
                    $error_msg .= $missing_fields[$i];
                } elseif ($i + 1 == count($missing_fields)) { // no comma for last word