'; } else if ( isset($_REQUEST['did']) && $_REQUEST['did'] ) { $saved = (dbQuery('UPDATE Devices SET Name=?, KeyString=? WHERE Id=?', array($name, $keyString, $_REQUEST['did']) ) !== null); } else { $saved = (dbQuery('INSERT INTO Devices SET Name=?, KeyString=?', array($name, $keyString) ) !== null); } if ( !$saved ) $error_message .= 'Error saving device: '.htmlspecialchars(dbLastError()).'
'; if ( !$error_message ) { $redirect = '?view=devices'; } else { // The modal posts view=device, which has no view file, so show the error on Devices. $view = 'devices'; } } } else { ZM\Error('Unknown action in device'); } // end if action ?>