4 Replies Latest reply on Jan 23, 2009 8:07 AM by (Nick_Jewett)

    Auto Insert

      Help! I'm trying to insert into a MYSQL database data posted by PayPal using a form with the "First check variable" set to one of the field names (AMT_PAID). My understanding is the the form should submit automatically and redirect to the next page (index.php). <br /> <br />The page is populating correctly but not submitting! I would really appreciate help with this %-) <br /> <br />Nick <br /> <br /><?php require_once('Connections/conn_xxx.php'); ?> <br /><?php<br />// Load the common classes<br />require_once('includes/common/KT_common.php');<br /><br />// Load the tNG classes<br />require_once('includes/tng/tNG.inc.php');<br /><br />// Make a transaction dispatcher instance<br />$tNGs = new tNG_dispatcher("");<br /><br />// Make unified connection variable<br />$conn_conn_catboats = new KT_connection($conn_xxx, $database_conn_catboats);<br /><br />// Make an insert transaction instance<br />$ins_DUES_PAID = new tNG_insert($conn_conn_xxx);<br />$tNGs->addTransaction($ins_DUES_PAID);<br />// Register triggers<br />$ins_DUES_PAID->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "AMT_PAID");<br />$ins_DUES_PAID->registerTrigger("END", "Trigger_Default_Redirect", 99, "index.php");<br />// Add columns<br />$ins_DUES_PAID->setTable("DUES_PAID");<br />$ins_DUES_PAID->addColumn("CBA_ID", "NUMERIC_TYPE", "POST", "CBA_ID", "{POST.item_number}");<br />$ins_DUES_PAID->addColumn("BANK_NBR", "STRING_TYPE", "POST", "BANK_NBR", "paypal");<br />$ins_DUES_PAID->addColumn("AMT_PAID", "DOUBLE_TYPE", "POST", "AMT_PAID", "{POST.settle_amount}");<br />$ins_DUES_PAID->addColumn("DATE_OF_DEP", "DATE_TYPE", "POST", "DATE_OF_DEP", "{POST.payment_date}");<br />$ins_DUES_PAID->addColumn("DUES_YEAR", "NUMERIC_TYPE", "POST", "DUES_YEAR", "{POST.memo}");<br />$ins_DUES_PAID->addColumn("Donation_Comments", "STRING_TYPE", "POST", "Donation_Comments", "{POST.memo}");<br />$ins_DUES_PAID->setPrimaryKey("DUES_PAID_ID", "NUMERIC_TYPE");<br /><br />// Execute all the registered transactions<br />$tNGs->executeTransactions();<br /><br />// Get the transaction recordset<br />$rsDUES_PAID = $tNGs->getRecordset("DUES_PAID");<br />$row_rsDUES_PAID = mysql_fetch_assoc($rsDUES_PAID);<br />$totalRows_rsDUES_PAID = mysql_num_rows($rsDUES_PAID);<br />?> <br /> <br /> <br /> <br /> <br /> <br /> <script src="includes/common/js/base.js" type="text/javascript"></script> <br /> <script src="includes/common/js/utility.js" type="text/javascript"></script> <br /> <script src="includes/skins/style.js" type="text/javascript"></script> <br /> <br /> <br /> <br /><?php<br /> echo $tNGs->getErrorMsg();<br />?> <br /> <form method="post" id="form1" action="%3C?php%20echo%20KT_escapeAttribute(KT_getFullUri());%20?%3E"> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <table cellpadding="2" cellspacing="0" class="KT_tngtable"> <tr> <td class="KT_th"> <label for="CBA_ID">CBA_ID:</label> </td> <td> <input type="text" name="CBA_ID" id="CBA_ID" value="<?php echo KT_escapeAttribute($row_rsDUES_PAID['CBA_ID']); ?>" size="32" /> <br /> <?php echo $tNGs->displayFieldHint("CBA_ID");?> <?php echo $tNGs->displayFieldError("DUES_PAID", "CBA_ID"); ?></td> </tr> <tr> <td class="KT_th"> <label for="BANK_NBR">Bank:</label> </td> <td> <input type="text" name="BANK_NBR" id="BANK_NBR" value="<?php echo KT_escapeAttribute($row_rsDUES_PAID['BANK_NBR']); ?>" size="32" /> <br /> <?php echo $tNGs->displayFieldHint("BANK_NBR");?> <?php echo $tNGs->displayFieldError("DUES_PAID", "BANK_NBR"); ?></td> </tr> <tr> <td class="KT_th"> <label for="AMT_PAID">AMT_PAID:</label> </td> <td> <input type="text" name="AMT_PAID" id="AMT_PAID" value="<?php echo KT_escapeAttribute($row_rsDUES_PAID['AMT_PAID']); ?>" size="32" /> <br /> <?php echo $tNGs->displayFieldHint("AMT_PAID");?> <?php echo $tNGs->displayFieldError("DUES_PAID", "AMT_PAID"); ?></td> </tr> <tr></tr> </table></form>
        • 1. Re: Auto Insert
          Günter Schenk Level 4
          Hi Nick,

          is there no URL variable available which you could use as "First check variable" condition ?

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Auto Insert
            Level 1
            Paypal posts their information but I also tried using URL variables to populate the form and set the "First check variable" to the form field name DUES_YEAR

            http://69.6.213.59/go2.php

            // Make an insert transaction instance
            $ins_DUES_PAID = new tNG_insert($conn_conn_xxx);
            $tNGs->addTransaction($ins_DUES_PAID);
            // Register triggers
            $ins_DUES_PAID->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "DUES_YEAR");
            $ins_DUES_PAID->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
            $ins_DUES_PAID->registerTrigger("END", "Trigger_Default_Redirect", 99, "index.php");
            // Add columns
            $ins_DUES_PAID->setTable("DUES_PAID");
            $ins_DUES_PAID->addColumn("CBA_ID", "NUMERIC_TYPE", "POST", "CBA_ID", "{GET.CBA_ID}");
            $ins_DUES_PAID->addColumn("BANK_NBR", "STRING_TYPE", "POST", "BANK_NBR", "paypal");
            $ins_DUES_PAID->addColumn("AMT_PAID", "DOUBLE_TYPE", "POST", "AMT_PAID", "{GET.AMT_PAID}");
            $ins_DUES_PAID->addColumn("DATE_OF_DEP", "DATE_TYPE", "POST", "DATE_OF_DEP", "{POST.payment_date}");
            $ins_DUES_PAID->addColumn("DUES_YEAR", "NUMERIC_TYPE", "POST", "DUES_YEAR", "{GET.YEAR}");
            $ins_DUES_PAID->addColumn("Donation_Comments", "STRING_TYPE", "POST", "Donation_Comments", "{POST.memo}");
            $ins_DUES_PAID->setPrimaryKey("DUES_PAID_ID", "NUMERIC_TYPE");
            • 3. Re: Auto Insert
              Günter Schenk Level 4
              please try with checking for the URL variable CBA_ID and see if this works

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: Auto Insert
                Level 1
                I tired it here and still not auto-inserting, I'm sure it's something simple I'm missing.

                Nick

                http://69.6.213.59/go2.php