0283f0d3e96fe85f11241197f477611680c01186
angie
  Mon Mar 4 09:58:59 2019 -0800
cartWebStart adds a hidden <input> to set db on every page.  However, some CGIs pass in NULL for db, so db is set to '(null)'.  Don't make the <input> unless a value is passed in.

diff --git src/hg/lib/cart.c src/hg/lib/cart.c
index 8379cc1..36dc637 100644
--- src/hg/lib/cart.c
+++ src/hg/lib/cart.c
@@ -2400,38 +2400,41 @@
 void cartVaWebStart(struct cart *cart, char *db, char *format, va_list args)
 /* Print out pretty wrapper around things when working
  * from cart. */
 {
 cartVaWebStartMaybeHeader(cart, db, FALSE, format, args);
 }
 
 void cartWebStart(struct cart *cart, char *db, char *format, ...)
 /* Print out pretty wrapper around things when working
  * from cart. */
 {
 va_list args;
 va_start(args, format);
 cartVaWebStart(cart, db, format, args);
 va_end(args);
-// WTF - variable outside of a form on almost every page we make below?
+if (isNotEmpty(db))
+    {
+    // Why do we put an input outside of a form on almost every page we make?
     // Tim put this in.  Talking with him it sounds like some pages might actually
     // depend on it.  Not removing it until we have a chance to test.  Best fix
     // might be to add it to cartSaveSession, though this would then no longer be
     // well named, and not all things have 'db.'  Arrr.  Probably best to remove
     // and test a bunch.
     cgiMakeHiddenVar("db", db);
     }
+}
 
 void cartWebStartHeader(struct cart *cart, char *db, char *format, ...)
 /* Print out Content-type header and then pretty wrapper around things when working
  * from cart. */
 {
 va_list args;
 va_start(args, format);
 cartVaWebStartMaybeHeader(cart, db, TRUE, format, args);
 va_end(args);
 }
 
 void cartWebEnd()
 /* Write out HTML footer and get rid or error handler. */
 {
 webEnd();