4 Replies Latest reply: Aug 15, 2011 1:49 AM by Mariahlinda RSS

    Desperate for help: ADDT registration form

    AGCI

      New to ADTT and back again with another, more urgent problem.

       

      I have used ADDT to create a registration page, using UPDATE instead of INSERT (this is necessary because the users are already in our system as contacts).  To accomplish this I had to do some hand coding and I fear I may have gone awry.  Initially I kept getting a blank page with the message "error: internal server" message when the page loaded...currently I get "Fatal error: Call to a member function addField() on a non-object in /home/agciorg/public_html/events/2009/259/users_Registration.php on line 33."  Now I can no longer open the registration page in Dreamweaver -- freezes DW everytime.  So I'm trying to edit in Text Edit to get it back to a functioning page.  I've already rebuilt the page from scratch twice trying to get things to work and I'm on a major time crunch and just can't afford to do it again.  Below is the current code (I've also attached the php file as a .txt)...any help in resolving my issue would be much, MUCH appreciated!

       

       

       

      <?php require_once('../../../Connections/AGCI.php'); ?>

      <?php

       

      // Load the common classes

      require_once('../../../includes/common/KT_common.php');

       

      // Load the tNG classes

      require_once('../../../includes/tng/tNG.inc.php');

       

      // Make a transaction dispatcher instance

      $tNGs = new tNG_dispatcher("../../../");

       

      // Make unified connection variable

      $conn_AGCI = new KT_connection($AGCI, $database_AGCI);

       

      // Start trigger

      $formValidation = new tNG_FormValidation();

      $formValidation->addField("UserFirstName", true, "text", "", "", "", "");

      $formValidation->addField("UserLastName", true, "text", "", "", "", "");

      $formValidation->addField("UserTitle", true, "text", "", "", "", "");

      $formValidation->addField("UserOrganization", true, "text", "", "", "", "");

      $formValidation->addField("UserEmail", true, "text", "email", "", "", "");

      $formValidation->addField("UserPassword", true, "text", "", "", "", "");

      $formValidation->addField("UserPhone", true, "text", "", "", "", "");

      $formValidation->addField("UserAddress", true, "text", "", "", "", "");

      $formValidation->addField("UserCity", true, "text", "", "", "", "");

      $formValidation->addField("UserState", true, "text", "", "", "", "");

      $formValidation->addField("UserZip", true, "text", "zip_generic", "", "", "");

      $formValidation->addField("UserCountry", true, "text", "", "", "", "");

      $formValidation->addField("UserExpertise", true, "text", "", "", "", "");

      $formValidation->addField("UserArrivalDate", true, "date", "", "", "", "");

      $formValidation->addField("UserDepartureDate", true, "date", "", "", "", "");

      $formValidation1->addField("UserPassword", true, "text", "", "", "", "");

      $tNGs->prepareValidation($formValidation);

      // End trigger

       

      //start Trigger_CheckPasswords trigger

      //remove this line if you want to edit the code by hand

      function Trigger_CheckPasswords(&$tNG) {

        $myThrowError = new tNG_ThrowError($tNG);

        $myThrowError->setErrorMsg("Passwords do not match.");

        $myThrowError->setField("UserPassword");

        $myThrowError->setFieldErrorMsg("The two passwords do not match.");

        return $myThrowError->Execute();

      }

      //end Trigger_CheckPasswords trigger

       

      //start Trigger_WelcomeEmail trigger

      //remove this line if you want to edit the code by hand

      function Trigger_WelcomeEmail(&$tNG) {

        $emailObj = new tNG_Email($tNG);

        $emailObj->setFrom("{KT_defaultSender}");

        $emailObj->setTo("{UserEmail}");

        $emailObj->setCC("");

        $emailObj->setBCC("info@agci.org");

        $emailObj->setSubject("Registration Confirmation");

        //FromFile method

        $emailObj->setContentFile("includes/mailtemplates/welcome.html");

        $emailObj->setEncoding("ISO-8859-1");

        $emailObj->setFormat("HTML/Text");

        $emailObj->setImportance("Normal");

        return $emailObj->Execute();

      }

      //end Trigger_WelcomeEmail trigger

       

       

      //start Trigger_ImageUpload trigger

      //remove this line if you want to edit the code by hand

      function Trigger_ImageUpload(&$tNG) {

        $uploadObj = new tNG_ImageUpload($tNG);

        $uploadObj->setFormFieldName("photo");

        $uploadObj->setDbFieldName("UserPhoto");

        $uploadObj->setFolder("../../../dB/ScientistPhotos/");

        $uploadObj->setResize("true", 200, 0);

        $uploadObj->setMaxSize(1500);

        $uploadObj->setAllowedExtensions("gif, jpg, jpeg, png");

        $uploadObj->setRename("custom");

        $uploadObj->setRenameRule("{rsUsers.UserFirstName}_{rsUsers.UserLastName}");

        return $uploadObj->Execute();

      }

      //end Trigger_ImageUpload trigger

       

      if (!function_exists("GetSQLValueString")) {

      function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

      {

        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

       

        $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

       

        switch ($theType) {

          case "text":

            $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

            break;  

          case "long":

          case "int":

            $theValue = ($theValue != "") ? intval($theValue) : "NULL";

            break;

          case "double":

            $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";

            break;

          case "date":

            $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

            break;

          case "defined":

            $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

            break;

        }

        return $theValue;

      }

      }

       

      mysql_select_db($database_AGCI, $AGCI);

      $query_rsUsers = "SELECT * FROM users";

      $rsUsers = mysql_query($query_rsUsers, $AGCI) or die(mysql_error());

      $row_rsUsers = mysql_fetch_assoc($rsUsers);

      $totalRows_rsUsers = mysql_num_rows($rsUsers);

       

      // Make an update transaction instance

      $UserRegistration = new tNG_update($conn_AGCI);

      $tNGs->addTransaction($UserRegistration);

      // Register triggers

      $UserRegistration->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Update1");

      $UserRegistration->registerTrigger("END", "Trigger_Default_Redirect", 99, "redirect.php");

      $UserRegistration->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);

      $UserRegistration->registerTrigger("AFTER", "Trigger_ImageUpload", 97);

      $UserRegistration->registerConditionalTrigger("{POST.UserPassword} != {POST.re_UserPassword}", "BEFORE", "Trigger_CheckPasswords", 50);

      $UserRegistration->registerTrigger("AFTER", "Trigger_WelcomeEmail", 60);

      // Add columns

      $UserRegistration->setTable("users");

      $UserRegistration->addColumn("UserContactType", "STRING_TYPE", "POST", "UserContactType");

      $UserRegistration->addColumn("UserEventID", "NUMERIC_TYPE", "POST", "UserEventID");

      $UserRegistration->addColumn("UserFirstName", "STRING_TYPE", "POST", "UserFirstName");

      $UserRegistration->addColumn("UserLastName", "STRING_TYPE", "POST", "UserLastName");

      $UserRegistration->addColumn("UserTitle", "STRING_TYPE", "POST", "UserTitle");

      $UserRegistration->addColumn("UserDepartment", "STRING_TYPE", "POST", "UserDepartment");

      $UserRegistration->addColumn("UserOrganization", "STRING_TYPE", "POST", "UserOrganization");

      $UserRegistration->addColumn("UserPhone", "STRING_TYPE", "POST", "UserPhone");

      $UserRegistration->addColumn("UserCellPhone", "STRING_TYPE", "POST", "UserCellPhone");

      $UserRegistration->addColumn("UserAddress", "STRING_TYPE", "POST", "UserAddress");

      $UserRegistration->addColumn("UserAddress2", "STRING_TYPE", "POST", "UserAddress2");

      $UserRegistration->addColumn("UserCity", "STRING_TYPE", "POST", "UserCity");

      $UserRegistration->addColumn("UserState", "STRING_TYPE", "POST", "UserState");

      $UserRegistration->addColumn("UserZip", "STRING_TYPE", "POST", "UserZip");

      $UserRegistration->addColumn("UserCountry", "STRING_TYPE", "POST", "UserCountry");

      $UserRegistration->addColumn("UserWebsite", "STRING_TYPE", "POST", "UserWebsite");

      $UserRegistration->addColumn("UserExpertise", "STRING_TYPE", "POST", "UserExpertise");

      $UserRegistration->addColumn("UserBio", "STRING_TYPE", "POST", "UserBio");

      $UserRegistration->addColumn("UserPhoto", "FILE_TYPE", "POST", "UserPhoto");

      $UserRegistration->addColumn("UserArrivalDate", "DATE_TYPE", "POST", "UserArrivalDate");

      $UserRegistration->addColumn("UserDepartureDate", "DATE_TYPE", "POST", "UserDepartureDate");

      $UserRegistration->addColumn("UserUnsureTravelDates", "CHECKBOX_YN_TYPE", "POST", "UserUnsureTravelDates");

      $UserRegistration->addColumn("User#AdultGuests", "NUMERIC_TYPE", "POST", "User_AdultGuests");

      $UserRegistration->addColumn("UserAdultGuestNames", "STRING_TYPE", "POST", "UserAdultGuestNames");

      $UserRegistration->addColumn("User#ChildGuests", "NUMERIC_TYPE", "POST", "User_ChildGuests");

      $UserRegistration->addColumn("UserChildGuestNames", "STRING_TYPE", "POST", "UserChildGuestNames");

      $UserRegistration->addColumn("UserUnsureGuests", "CHECKBOX_YN_TYPE", "POST", "UserUnsureGuests");

      $UserRegistration->addColumn("UserBookRoom", "CHECKBOX_YN_TYPE", "POST", "UserBookRoom");

      $UserRegistration->addColumn("UserComments", "STRING_TYPE", "POST", "UserComments");

      $UserRegistration->addColumn("UserRegistrationDate", "DATE_TYPE", "POST", "UserRegistrationDate");

      $UserRegistration->addColumn("UserEmail", "STRING_TYPE", "POST", "UserEmail", "{SESSION.kt_login_user}");

      $UserRegistration->addColumn("UserPassword", "STRING_TYPE", "POST", "UserPassword");

       

       

       

      // Make an update transaction instance

      $UsersRegistration = new tNG_update($conn_AGCI);

      $tNGs->addTransaction($UsersRegistration);

       

       

      // Execute all the registered transactions

      $tNGs->executeTransactions();

       

      // Get the transaction recordset

      $rsusers = $tNGs->getRecordset("users");

      $row_rsusers = mysql_fetch_assoc($rsusers);

      $totalRows_rsusers = mysql_num_rows($rsusers);

      ?>

      .....
      <!-----------------begin registration form----------------->
      <div id="RegistrationContainer">
            <form method="post" name="RegistrationForm" id="RegistrationForm" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>"> 
              <table width="515" border="0" align="right">
      <tr>
        <td height="135" colspan="2" valign="top" scope="col">
            <?php
      echo $tNGs->getErrorMsg();
      ?>
                      <h1 align="left">Registration Form</h1>
        <br>
          <span class="style5">Please read the logistics information prior to completing the registration form.</span><br />
             There are a limited number of spots available in this workshop.  To secure a spot, please fill out this registration form to the best of your ability as soon as possible.  Please notify AGCI of any subsequent changes to the information submitted below.
                      </td>
      </tr>
            <tr>
              <td height="37" colspan="2" scope="col"><strong>Create a Password</strong></td>
             </tr>
      <tr>
              <td height="53" colspan="2" valign="top" scope="col">
      <table cellpadding="2" cellspacing="0" class="KT_tngtable">
        <tr>
      <td width="127" class="KT_th"><label for="UserPassword">Password:</label></td>
      <td width="248">
      <input type="password" name="UserPassword" id="UserPassword" value="" size="32" />
      <?php echo $tNGs->displayFieldHint("UserPassword");?>
      <?php echo $tNGs->displayFieldError("users", "UserPassword"); ?>
      </td>
      </tr>
      <tr>
      <td class="KT_th"><label for="re_UserPassword">Re-type Password:</label></td>
      <td>
      <input type="password" name="re_UserPassword" id="re_UserPassword" value="" size="32" />
      </td>
      </tr>
        <tr>
      <td class="KT_th"><label for="UserEmail">Email (username):</label></td>
      <td>
      <input type="text" name="UserEmail" id="UserEmail" value="<?php echo $_SESSION['kt_login_user']; ?>" size="32" />
      <?php echo $tNGs->displayFieldHint("UserEmail");?>
      <?php echo $tNGs->displayFieldError("users", "UserEmail"); ?>
      </td>
      </tr>
           
      </table>
      </td>
             </tr>
      <tr>
              <td height="37" colspan="2" scope="col"><strong>Contact/Personal Information</strong></td>
             </tr>
           
         
      <tr>
      <td width="229" height="323" align="right" valign="top" scope="col">
              
      <input name="UserContactType" type="hidden" value="Scientist">
      <input name="UserEventID" type="hidden" value="259"> <!---NEEDS TO BE CHANGED FOR EACH WORKSHOP--->
      <?php $date = getdate(); ?>
      <input name="UserRegistrationDate" type="hidden"  value="<?php echo $date ?>" >
                <p align="right"><span class="style5">*</span>First name:
                  <input type=text name="firstname" value="<?php echo $_SESSION['kt_UserFirstName']; ?>"></p>
         <p align="right"><span class="style5">*</span>Last Name:
                 <input type=text name="lastname" value="<?php echo $_SESSION['kt_UserLastName']; ?>"></p>
                <p align="right"><span class="style5">*</span> Job Title:
                  <input type=text name="title"></p>
                <p align="right">Department:
                 <input type=text name="department"></p>
               <p align="right"><span class="style5">*</span>Organization:
                 <input type=text name="organization"></p>
             
               <p align="right"><span class="style5">*</span>Office Phone:
                 <input type=text name="officephone"></p> 
                <p align="right">Cell Phone:
                 <input type=text name="cellphone"></p>     
                
                  </td>
           
                      <td width="255" height="323" valign="top" scope="col">
                    
               <p align="right"><span class="style5">*</span>Address 1:
                  <input type=text name="address1"></p>
               <p align="right">Address 2:
                 <input type=text name="address2"></p>
                <p align="right"><span class="style5">*</span>City:
                  <input type=text name="city"></p>
               <p align="right"><span class="style5">*</span>State / Province:
                 <input type=text name="state"></p>
               <p align="right"><span class="style5">*</span>Zip / Postal Code:
                 <input type=text name="zipcode"></p>
               <p align="right"><span class="style5">*</span>Country:
                 <select name="req_country">
                    <option value="Argentina">Argentina
                    <option value="Australia">Australia
                    <option value="Austria">Austria
                    <option value="Belgium">Belgium
                    <option value="Brazil">Brazil
                    <option value="Canada">Canada
                    <option value="Caribbean_Islands">Caribbean Islands
                    <option value="Chile">Chile
                    <option value="China">China
                    <option value="Colombia">Colombia
                    <option value="Denmark">Denmark
                    <option value="Ecuador">Ecuador
                    <option value="Egypt">Egypt
                    <option value="Finland">Finland
                    <option value="France">France
                    <option value="Germany">Germany
                    <option value="Greece">Greece
                    <option value="Greenland">Greenland
                    <option value="Hong_Kong">Hong Kong
                    <option value="Iceland">Iceland
                    <option value="India">India
                    <option value="Indonesia">Indonesia
                    <option value="Ireland">Ireland
                    <option value="Israel">Israel
                    <option value="Italy">Italy
                    <option value="Japan">Japan
                    <option value="Korea">Republic of Korea
                    <option value="Luxembourg">Luxembourg
                    <option value="Malaysia">Malaysia
                    <option value="Mexico">Mexico
                    <option value="Netherlands">Netherlands
                    <option value="New_Zealand">New Zealand
                    <option value="Norway">Norway
                    <option value="Philippines">Philippines
                    <option value="Portugal">Portugal
                    <option value="Russian">Russian Federation
                    <option value="Saudi_Arabia">Saudi Arabia
                    <option value="Singapore">Singapore
                    <option value="South_Africa">South Africa
                    <option value="Spain">Spain
                    <option value="Sweden">Sweden
                    <option value="Switzerland">Switzerland
                    <option value="China">Province Of China Taiwan
                    <option value="Thailand">Thailand
                    <option value="Turkey">Turkey
                    <option value="United Kingdom">United Kingdom
                    <option value="US" selected="selected">United States
                    <option value="Venezuela">Venezuela
                    <option value="Viet_Nam">Viet Nam
                    <option value="N/A">Not listed
                </select></p>
              
                  <p align="right">Website:
                 <input type=text name="website"></p>
                  <p align="right"><span class="style5">*</span>Expertise:
                  <input type=text name="expertise"></p>
                <br>        
                </td>
      </tr>
            
         <tr>
                <td colspan="2" align="right" valign="top" scope="col">
                
                  <p><strong>Attach bio:</strong>
        Please type or cut and paste a short professional bio. <br>
        <textarea name="bio" rows="20" style="width:100%"></textarea> <br>
      </p>
      <br>
      <p><strong>Upload photo:</strong>
                    <input class="noformstyle" type="file" name="photo" size="30" ><br>
      (max. 1.5Mb; allowed file types: *.jpg, *.gif, *png only)</p>
      <br>
      <div class="lineDiv"></div>
      <br>
      </td>
             </tr>
            <tr>
                <td height="66" align="right" valign="top" scope="col"><p><strong><span class="style5">*</span>Travel</strong></p>
      <p>Arrival Date:
                 <input name="arrivaldate" id="arrivaldate" value="" size="11"><a href="javascript:void(0)" onClick="if(self.gfPop)gfPop.fPopCalendar(document.RegistrationForm.arrivaldate);return false;" ><img class="PopcalTrigger" align="absmiddle" src="http://www.agci.org/JavaScript/calendar/calbtn.gif" width="34" height="22" border="0" alt=""></a>
                  </p>          
                  </td>
               
                  <td height="66" align="right" valign="top" scope="col">
                  
                    <div align="right">
                      <p> </p>
                      <p>Departure Date:
                        <input name="departuredate" id="departuredate" value="" size="11"><a href="javascript:void(0)" onClick="if(self.gfPop)gfPop.fPopCalendar(document.RegistrationForm.departuredate);return false;" ><img class="PopcalTrigger" align="absmiddle" src="http://www.agci.org/JavaScript/calendar/calbtn.gif" width="34" height="22" border="0" alt=""></a>
                      </p>
                    </div>
                  </td>
      </tr>
            <tr>
                <td height="34" colspan="2" align="right" valign="top" scope="col">
                  <label>
                  <input type="checkbox" name="travel" id="checkbox" value="unsure of travel dates at this time" class="noformstyle" />
                    I do not know my planned travel dates at this time.
                    </label>
                  
                I will notify AGCI as soon as I have made my travel arrangements (see Logistics for information on travel and how to book your travel with AGCI's travel agent).
                 </td>
              </tr>
           
                <td height="184" colspan="2" valign="bottom" scope="col">
                    <br>
      <div class="lineDiv"></div>
      <br>
      <p><span class="style5">*</span><strong>I will be bringing the following guests:</strong></p>
             
                  <p># of Adults:    <select name="adultguests" size="1">
                    <option value="0">0</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                  </select>  Names: <input type=text name="adultguestnames">
                  </p>
                
                  <p># of Children: <select name="childguests" size="1">
                    <option value="0">0</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                  </select>  Names:
                  <input type=text name="childguestnames">
                   <br />
                   <br />
                   <input type="checkbox" name="guests" id="checkbox2" value="unsure about guests at this time" class="noformstyle"/>
                       I am not sure about guests at this time. I will let AGCI know at a later date if I decide to bring a guest or child.
                    </td>
              </tr>
            <tr>
              <td height="182" colspan="2" valign="bottom" scope="col">
      <br>
      <div class="lineDiv"></div>
      <br>
                      <p><span class="style5">*</span><strong>Lodging</strong></p>
                        
                <input type="radio" name="book a room?" value="yes" class="noformstyle">
                   <strong>Please reserve a room for me and my guest(s) at the Molly Gibson Lodge.</strong>  A lodging confirmation will be sent to you once you are
      registered. If you plan on extending your stay before or after the workshop dates, please let us know so that we can make appropriate arrangements with the hotel.<br />
      <br />
                  
                <input type="radio" name="book a room?" value="no" class="noformstyle">
                    <strong> I do not require lodging at the Molly Gibson. </strong>I will notify AGCI of where I intend to stay,
      and I understand the reimbursement procedures as described in the logistics information.        
      </td>
             </tr>
            <tr>
                <td height="218" colspan="2" valign="bottom" scope="col">
                  <p><strong>Comments:</strong><br>
                  <textarea name="comments" cols="400" rows="3"></textarea></p>
                  </td>
             </tr>
            <tr>
               <td height="57" colspan="2" valign="middle" scope="col">
                  <span class="style5">* required field</span>
                 </td>
              </tr>
            <tr>
               <td height="20" colspan="2" valign="bottom" scope="col">
               
            
            
             
              <input class="submit" type="submit" name="KT_Insert1" id="KT_Insert1" value="Register"></td>
             </tr>
            <tr>
              <td height="121" colspan="2" valign="bottom" scope="col">
                </td>
             </tr>
       
           </table>
      </form>
      </div>
      <!-----------------end registration form----------------->