1 Reply Latest reply on Mar 6, 2008 11:45 AM by Günter Schenk

    default value as a url variable

      I created an insert record form. One of the columns is hidden with the default value "{GET.inv_number}".

      This was automatically generated when I selected the default value to equal the url variable inv_number.

      code:

      $ins_invoice_items->addColumn("items_inv_id", "STRING_TYPE", "POST", "items_inv_id", "{GET.inv_number}");

      the link to this page is add.item.php?inv_number="value from previous page"

      right now it is add.item.php?inv_number=1

      The default value for column items_inv_id is not reading the variable.

      I have tried creating it manually $inv_number = $_GET['inv_number'];

      the code then looks like this:

      $ins_invoice_items->addColumn("items_inv_id", "STRING_TYPE", "POST", "items_inv_id", $inv_number);

      Still no value.

      If I write <?php echo $inv_number; ?> in the body, the value of 1 shows up.

      Why isn't dev toolbox reading this variable?

      Scott
        • 1. Re: default value as a url variable
          Günter Schenk Level 4
          Hi Scott,

          ----
          $ins_invoice_items->addColumn("items_inv_id", "STRING_TYPE", "POST", "items_inv_id", "{GET.inv_number}");
          ----

          I *think* you´re having a conflict here -- if your hidden field "items_inv_id" already contains that URL variable, the default "addColumn" line...

          $ins_invoice_items->addColumn("items_inv_id", "STRING_TYPE", "POST", "items_inv_id");

          ...should be sufficient, as it´s supposed to grab the value from that field.

          Whenever I´m inserting some value that´s derived from an URL variable, I actually bypass any related hidden field and do that directly, e.g.

          $ins_invoice_items->addColumn("items_inv_id", "STRING_TYPE", "GET", "inv_number");

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver