Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/php/
Upload File :
Current File : /var/www/cesa.co.za/php/ypfjoin2.php

<?php
//error_reporting(E_ALL);
//ini_set("display_errors", 1);

$pagetitle = "Join the YPF";

include_once($_SERVER['DOCUMENT_ROOT'] . "/php/inc_db.php");
include_once($_SERVER['DOCUMENT_ROOT'] . '/cesanet/inc_shared.php');
?>
<img src="https://www.cesa.co.za/sites/default/files/CESA%20YPF_Logo_small.jpg" alt="YPF" hspace="10" />
<?php
$bDisplayForm = true;

if (isset($_POST["act"])) {
    // Check for all fields filled in
    if (
        empty($_POST["Association"]) || empty($_POST["FirstName"]) || empty($_POST["Surname"]) || empty($_POST["TelNum"]) || empty($_POST["DOBYear"])
        || !is_numeric($_POST["DOBYear"])
    ) {
        echo "<p><font color='red'><b>The following fields are all required:<br>
		Your membership association,<br>
		First name and surname,<br>
		Telephone number,<br>
		Year of birth<br>
		Please ensure that all the required information has been filled in, and resubmit the form:</b></font></p>";
        //Check year of birth
    } elseif (date("Y", mktime(0, 0, 0, 0, 0, $_POST["DOBYear"])) <= (date("Y") - 40)) {
        echo "<p><font color='red'><b>You must be 40 years of age or younger to join the Young Professionals Forum</b></font></p>";
    } else {

        // Check for an existing, matching contact
        $sMatchMsg = "";
        $arrMatchIDs = array();

        // First check on email address
        if (!empty($_POST["Email"])) {
            $sql = "SELECT ContactsID FROM YPFContacts WHERE LOWER(PreferredEmail)='" . strtolower(addslashes($_POST["Email"])) . "'";
            $recContacts = mysql_query($sql);
            while ($rowContacts = mysql_fetch_assoc($recContacts)) {
                $sMatchMsg = "Email address";
                $arrMatchIDs[] = $rowContacts["ContactsID"];
            }
            mysql_free_result($recContacts);
        }

        // Then check on name
        if (strlen($sMatchMsg) <= 0) {
            $sql = "SELECT ContactsID FROM YPFContacts WHERE LOWER(ContactFirstName)='" . strtolower(addslashes($_POST["FirstName"])) . "'
			AND LOWER(ContactSurname)='" . strtolower($_POST["Surname"]) . "'";
            $recContacts = mysql_query($sql);
            while ($rowContacts = mysql_fetch_assoc($recContacts)) {
                $sMatchMsg = "First name and Surname";
                $arrMatchIDs[] = $rowContacts["ContactsID"];
            }
            mysql_free_result($recContacts);
        }
        if (empty($sMatchMsg)) {
            $sql = "SELECT ContactsID FROM YPFContacts WHERE LOWER(ContactInitials)='" . strtolower(addslashes($_POST["Initials"])) . "'
			AND LOWER(ContactSurname)='" . strtolower(addslashes($_POST["Surname"])) . "' AND ((ContactFirstName IS NULL) OR (ContactFirstName=''))";
            $recContacts = mysql_query($sql);
            while ($rowContacts = mysql_fetch_assoc($recContacts)) {
                $sMatchMsg = "Initials and Surname";
                $arrMatchIDs[] = $rowContacts["ContactsID"];
            }
            mysql_free_result($recContacts);
        }

        // If there was no match to existing data, add this as a new contact
        if (strlen($sMatchMsg) <= 0 || (isset($_REQUEST['selContact']) && $_REQUEST['selContact'] == 'NONE')) {
            $sDOB = "NULL";
            if (!empty($_POST["DOBDay"]) && !empty($_POST["DOBMonth"]) && !empty($_POST["DOBYear"]) && is_numeric($_POST["DOBDay"]) && is_numeric($_POST["DOBYear"]))
                $sDOB = "'" . $_POST["DOBYear"] . "-" . $_POST["DOBMonth"] . "-" . substr("00" . $_POST["DOBDay"], -2) . "'";

            $iOfficeHead = 0;
            if (isset($_POST["OfficeHead"]) && ($_POST["OfficeHead"] == "y"))
                $iOfficeHead = 1;
            $iPrincipal = 0;
            if (isset($_POST["Principal"]) && ($_POST["Principal"] == "y"))
                $iPrincipal = 1;

            $sql = "INSERT INTO YPFContacts (ContactSurname, ContactInitials, ContactFirstName,
				ContactDesignation, PositionInFirm,
			OfficeHead, Principal, Association)
				VALUES ('" . addslashes($_POST["Surname"]) . "',
			'" . addslashes($_POST["Initials"]) . "', '" . addslashes($_POST["FirstName"]) . "',
			'" . addslashes($_POST["Designation"]) . "', '" . addslashes($_POST["Position"]) . "',
			" . $iOfficeHead . ", " . $iPrincipal . ", '" . addslashes($_POST["Association"]) . "')";
            mysql_query($sql);

            // Get new ContactsID
            $query = "SELECT MAX(ContactsID) FROM YPFContacts AS ContactsID";
            $result = mysql_query($query) or die("Scope_Identity Failed");
            $row = mysql_fetch_array($result);
            $NewContactsID = $row[0];

            $sql = "UPDATE YPFContacts SET PersonalTel='" . addslashes($_POST["TelNum"]) . "',
			PersonalFax='" . addslashes($_POST["PersonalFax"]) . "', CellPhone='" . addslashes($_POST["CellPhone"]) . "',
			PreferredEmail='" . addslashes($_POST["Email"]) . "', BirthDate=" . addslashes($sDOB) . ",
			ProfessionalRegistrations='" . addslashes($_POST["ProfReg"]) . "',
			Qualifications='" . addslashes($_POST["Qual"]) . "',
			IDNumber='" . addslashes($_POST["IDNumber"]) . "', Comments='" . addslashes($_POST["Expertise"]) . "',
			Association='" . addslashes($_POST["Association"]) . "',
            Province='" . addslashes($_POST["Province"]) . "'
			WHERE ContactsID = " . $NewContactsID;
            mysql_query($sql);

            $sql = "INSERT INTO `Contacts` (  `ContactSurname`,  `ContactInitials`, `ContactFirstName`,  `ContactDesignation`,  `Language`,
  `BirthDate`,  `NameOfSpouse`,  `CellPhone`,  `PersonalTel`,  `PersonalFax`,  `Comments`,  `ProfessionalRegistrations`,  `Qualifications`,
  `PreferredEmail`,  `ContactType`,  `PostalAddress`,  `Address2`,  `TownCity`,  `Country`,  `PostalCode`,  `OrgName`,  `IDNumber`
) SELECT   `ContactSurname`,  `ContactInitials`,  `ContactFirstName`,  `ContactDesignation`,  `Language`,  `BirthDate`,  `NameOfSpouse`,  `CellPhone`,
  `PersonalTel`,  `PersonalFax`,  `Comments`,  `ProfessionalRegistrations`,  `Qualifications`,  `PreferredEmail`,  'YPF',  `PostalAddress`,  `Address2`,
   `TownCity`,  `Country`,  `PostalCode`,  Association,  `IDNumber` FROM YPFContacts WHERE ContactsID = " . $NewContactsID;
            mysql_query($sql);
            echo "<p><b>Thank you. We have added your information to our database.</b></p>";

            if (!empty($_POST["Email"])) {

                $messageText = '<p>Dear YPF Member,</p>'
                    . '<p><b>Welcome on board as a member of the YPF.</b></p>'
                    . '<p>It is with great pleasure that I welcome you to our forum.</p>'
                    . '<p>We are happy that you chose to join CESA and hope that you will continue being a valued participant and contributor of our forum and organization.</p>'
                    . '<p>CESA YPF objectives include:'
                    . '<ul>'
                    . '<li>Promoting of engineering and built environment careers, the consulting engineering Industry and CESA</li>'
                    . '<li>Retention of young professionals within the engineering industry</li>'
                    . '<li>Building capacity and knowledge amongst members of the YPF</li>'
                    . '<li>Sharing Information and networking</li>'
                    . '<li>Aiding professional registration</li>'
                    . '</ul>'
                    . '</p>'
                    . '<p>Benefits of joining YPF/volunteering:'
                    . '<ul>'
                    . '<li>You would be on our newsletter that will keep you informed about the industry.</li>'
                    . '<li>You would be included on issues that affect the industry directly.</li>'
                    . '<li>You will be given opportunities that most won\'t get, such as invites to events and networking with industry leaders.</li>'
                    . '<li>You will contribute to making a difference to people.</li>'
                    . '</ul>'
                    . '</p>'
                    . '<p>Your participation and contribution will be highly valued. Once again, welcome and feel free to share your thoughts with us.</p>'
                    . '<p>Yours faithfully,</p>'
                    . '<p>____________________</p>'
                    . '<p><b>Godfrey Ramalisa</b><br />'
                    . 'Manager: Stakeholder Liaison<br />'
                    . 'Email: <a href="mailto:godfreyr@cesa.co.za">godfreyr@cesa.co.za</a><br />'
                    . 'Webpage: <a href="https://www.cesa.co.za/ypf/">https://www.cesa.co.za/ypf/</a></p>';

                maill($_POST["Email"], "Welcome on board as member of the YPF.", $messageText, null, array('from-address' => 'webmaster@cesa.co.za', 'from-name' => 'CESA YPF', 'isHTML' => true));
            }

            $bDisplayForm = false;

            $mailbody = "<p><b>YPF Contact information submitted on the CESA website:</b><br>
			<table border=1 width=600 cellspacing=0 cellpadding=10>
			<tr><td><b>Association</b></td><td>" . $_POST["Association"] . "</td></tr>
			<tr><td><b>Province</b></td><td>" . $_POST["Province"] . "</td></tr>
			<tr><td><b>Position</b></td><td>" . $_POST["Position"] . "</td></tr>
			<tr><td><b>Designation</b></td><td>" . $_POST["Designation"] . "</td></tr>
			<tr><td><b>Initials</b></td><td>" . $_POST["Initials"] . "</td></tr>
			<tr><td><b>First Name</b></td><td>" . $_POST["FirstName"] . "</td></tr>
			<tr><td><b>Surname</b></td><td>" . $_POST["Surname"] . "</td></tr>
			<tr><td><b>Tel Num</b></td><td>" . $_POST["TelNum"] . "</td></tr>
			<tr><td><b>Cell Num</b></td><td>" . $_POST["CellPhone"] . "</td></tr>
			<tr><td><b>Email Address</b></td><td>" . $_POST["Email"] . "</td></tr>
			<tr><td><b>Birth Date</b></td><td>" . $_POST["DOBDay"] . "/" . $_POST["DOBMonth"] . "/" . $_POST["DOBYear"] . "</td></tr>
			<tr><td><b>Professional Registrations</b></td><td>" . $_POST["ProfReg"] . "</td></tr>
			<tr><td><b>Qualifications</b></td><td>" . $_POST["Qual"] . "</td></tr>
			<tr><td><b>Fields of Expertise</b></td><td>" . $_POST["Expertise"] . "</td></tr>
			</table>
			";

            $headers = 'MIME-Version: 1.0' . "\r\n";
            $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
            $headers .= 'From: webmaster@cesa.co.za' . "\r\n";

            mail("godfrey@cesa.co.za", "New YPF Contact", $mailbody, $headers);
        } else {
            // Display the matches
            echo "<p><b>The information you have provided matches one or more existing records in our database, which have the same " . $sMatchMsg . ". If one of the records displayed below is in fact you, please select it so that we know to update the information with the data you have provided.</b></p>";
            $bDisplayForm = false;
?>
            <form action="/ypf/young-professionals-forum/about-the-ypf/join-the-ypf-non-members/" method="post">
                <input type="hidden" name="Association" value="<?php echo $_POST["Association"]; ?>" />
                <input type="hidden" name="FirstName" value="<?php echo stripslashes($_POST["FirstName"]); ?>" />
                <input type="hidden" name="Surname" value="<?php echo stripslashes($_POST["Surname"]); ?>" />
                <input type="hidden" name="Initials" value="<?php echo $_POST["Initials"]; ?>" />
                <input type="hidden" name="Designation" value="<?php echo $_POST["Designation"]; ?>" />
                <input type="hidden" name="TelNum" value="<?php echo $_POST["TelNum"]; ?>" />
                <input type="hidden" name="PersonalFax" value="<?php echo $_POST["PersonalFax"]; ?>" />
                <input type="hidden" name="CellPhone" value="<?php echo $_POST["CellPhone"]; ?>" />
                <input type="hidden" name="Email" value="<?php echo $_POST["Email"]; ?>" />
                <input type="hidden" name="DOBDay" value="<?php echo $_POST["DOBDay"]; ?>" />
                <input type="hidden" name="DOBMonth" value="<?php echo $_POST["DOBMonth"]; ?>" />
                <input type="hidden" name="DOBYear" value="<?php echo $_POST["DOBYear"]; ?>" />
                <input type="hidden" name="IDNumber" value="<?php echo $_POST["IDNumber"]; ?>" />
                <input type="hidden" name="ProfReg" value="<?php echo stripslashes($_POST["ProfReg"]); ?>" />
                <input type="hidden" name="Qual" value="<?php echo stripslashes($_POST["Qual"]); ?>" />
                <input type="hidden" name="Expertise" value="<?php echo stripslashes($_POST["Expertise"]); ?>" />
                <input type="hidden" name="Position" value="<?php echo stripslashes($_POST["Position"]); ?>" />
                <input type="hidden" name="Principal" value="<?php echo $_POST["Principal"]; ?>" />
                <input type="hidden" name="OfficeHead" value="<?php echo $_POST["OfficeHead"]; ?>" />
                <input type="hidden" name="Province" value="<?php echo $_POST["Province"]; ?>" />
                <table border=1 width=600 cellspacing=0 cellpadding=10>
                    <tr>
                        <td>&nbsp;</td>
                        <td><b>Firm</b></td>
                        <td><b>Office</b></td>
                        <td><b>Initials</b></td>
                        <td><b>First Name</b></td>
                        <td><b>Surname</b></td>
                    </tr>
                    <?php
                    $sql = "SELECT Contacts.ContactsID, Contacts.ContactFirstName, Contacts.ContactSurname, Contacts.ContactInitials,
				tblMemberFirms.FirmName, tblMemberFirmOffices.OfficeStatus, tblMemberFirmOffices.Province, tblMemberFirmOffices.GeoLocation
				FROM tblMemberFirms, tblMemberFirmOffices, OfficeContacts, Contacts
				WHERE tblMemberFirms.FirmID = tblMemberFirmOffices.FirmID
				AND tblMemberFirmOffices.OfficeID = OfficeContacts.OfficeID
				AND OfficeContacts.ContactsID = Contacts.ContactsID
				AND Contacts.ContactsID IN (" . implode(",", $arrMatchIDs) . ")";
                    //                    echo $sql . '<br />';
                    $recContacts = mysql_query($sql);
                    while ($rowContacts = mysql_fetch_assoc($recContacts)) {
                    ?>
                        <tr>
                            <td><input type="radio" name="selContact" value="<?php echo $rowContacts["ContactsID"]; ?>" /></td>
                            <td><?php echo $rowContacts["FirmName"]; ?></td>
                            <td><?php echo $rowContacts["OfficeStatus"] . "-" . $rowContacts["Province"] . "-" . $rowContacts["GeoLocation"]; ?></td>
                            <td><?php echo $rowContacts["ContactInitials"]; ?></td>
                            <td><?php echo $rowContacts["ContactFirstName"]; ?></td>
                            <td><?php echo $rowContacts["ContactSurname"]; ?></td>
                        </tr>
                    <?php
                    }
                    mysql_free_result($recContacts);
                    ?>
                    <tr>
                        <td><input type="radio" name="selContact" value="NONE" checked="checked" /></td>
                        <td colspan=5><b>None of the above is a match. Please add me as a new record.</b></td>
                    </tr>
                    <tr>
                        <td colspan=6 align=center><input type="submit" name="act" value="Confirm and Continue" /></td>
                    </tr>
                </table>
            </form>
    <?php
        }
    }
}

if ($bDisplayForm) {
    ?>
    <script type="text/javascript" src="/YPF/ajax.js"></script>
    <script language="javascript">
        var dynamicContent_ajaxObjects = new Array();

        function findObj(n, d) { //v4.01
            var p, i, x;
            if (!d)
                d = document;
            if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
                d = parent.frames[n.substring(p + 1)].document;
                n = n.substring(0, p);
            }
            if (!(x = d[n]) && d.all)
                x = d.all[n];
            for (i = 0; !x && i < d.forms.length; i++)
                x = d.forms[i][n];
            for (i = 0; !x && d.layers && i < d.layers.length; i++)
                x = findObj(n, d.layers[i].document);
            if (!x && d.getElementById)
                x = d.getElementById(n);
            return x;
        }

        function onlyNumbers(inputString) {

            var searchForNumbers = /\D+\_+\W+\s+\S+/

            return (searchForNumbers.test(inputString) ? false : true);

        }

        function GetOffices(iFirmID) {
            var ajaxIndex = dynamicContent_ajaxObjects.length;

            dynamicContent_ajaxObjects[ajaxIndex] = new sack();

            dynamicContent_ajaxObjects[ajaxIndex].requestFile = '/php/getoffices.php?FirmID=' + iFirmID; // Specifying which file to get
            dynamicContent_ajaxObjects[ajaxIndex].execute = true;
            dynamicContent_ajaxObjects[ajaxIndex].runAJAX(); // Execute AJAX function

        }

        function MM_validateForm() { //v4.0
            if (document.getElementById) {
                var i, p, q, nm, test, num, min, max, errors = '',
                    args = MM_validateForm.arguments;
                for (i = 0; i < (args.length - 2); i += 3) {
                    test = args[i + 2];
                    val = document.getElementById(args[i]);
                    if (val) {
                        nm = val.name;
                        if ((val = val.value) != "") {
                            if (test.indexOf('isEmail') != -1) {
                                p = val.indexOf('@');
                                if (p < 1 || p == (val.length - 1))
                                    errors += '- ' + nm + ' must contain an e-mail address.\n';
                            } else if (test != 'R') {
                                num = parseFloat(val);
                                if (isNaN(val))
                                    errors += '- ' + nm + ' must contain a number.\n';
                                if (test.indexOf('inRange') != -1) {
                                    p = test.indexOf(':');
                                    min = test.substring(8, p);
                                    max = test.substring(p + 1);
                                    if (num < min || max < num)
                                        errors += '- ' + nm + ' must contain a number between ' + min + ' and ' + max + '.\n';
                                }
                            }
                        } else if (test.charAt(0) == 'R')
                            errors += '- ' + nm + ' is required.\n';
                    }
                }
                if (errors)
                    alert('The following error(s) occurred:\n' + errors);
                document.MM_returnValue = (errors == '');
            }
        }
    </script>
    <h1>Update Your YPF Contact Details</h1>


    <form action="/ypf/young-professionals-forum/about-the-ypf/join-the-ypf-non-members/" method="post" name="form1" id="form1" onsubmit="MM_validateForm('FirstName', '', 'R', 'Surname', '', 'R', 'TelNum', '', 'R', 'DOBYear', '', 'RisNum');
                return document.MM_returnValue">
        <table width="682" border="0" cellspacing="0" cellpadding="5">
            <tr>
                <td width="265" align="right" valign="top" nowrap="nowrap">Association you belong to:</td>
                <td width="397" valign="top"><label>
                        <input type="text" name="Association" id="Association" value="<?php echo $_REQUEST["Association"]; ?>" size="40">
                    </label></td>
            </tr>
            <tr>
                <td align="right" valign="top" nowrap="nowrap">Designation:</td>
                <td valign="top"><select name="Designation" id="Designation">
                        <option value="Mr" selected="selected">Mr</option>
                        <option value="Miss">Miss</option>
                        <option value="Mrs">Mrs</option>
                        <option value="Ms">Ms</option>
                        <option value="Dr">Dr</option>
                        <option value="Prof">Prof</option>
                    </select></td>
            </tr>
            <tr>
                <td align="right" valign="top" nowrap="nowrap">First Name:</td>
                <td valign="top"><label>
                        <input name="FirstName" type="text" id="FirstName" size="40" />
                    </label></td>
            </tr>
            <tr>
                <td align="right" valign="top" nowrap="nowrap">Initials:</td>
                <td valign="top"><label>
                        <input name="Initials" type="text" id="Initials" size="40" />
                    </label></td>
            </tr>
            <tr>
                <td align="right" valign="top" nowrap="nowrap">Surname:</td>
                <td valign="top"><label>
                        <input name="Surname" type="text" id="Surname" size="40" />
                    </label></td>
            </tr>
            <tr>
                <td align="right" valign="top" nowrap="nowrap">Telephone Number:</td>
                <td valign="top"><input name="TelNum" type="text" id="TelNum" size="40" /></td>
            </tr>
            <tr>
                <td align="right" valign="top" nowrap="nowrap">Cellphone Number:</td>
                <td valign="top"><input name="CellPhone" type="text" id="CellPhone" size="40" /></td>
            </tr>
            <tr>
                <td align="right" valign="top" nowrap="nowrap">Fax Number:</td>
                <td valign="top"><input name="PersonalFax" type="text" id="PersonalFax" size="40" /></td>
            </tr>
            <tr>
                <td align="right" valign="top" nowrap="nowrap">Email Address:</td>
                <td valign="top"><input name="Email" type="text" id="Email" size="40" /></td>
            </tr>
            <tr>
                <td align="right" valign="top">Date Of Birth:</td>
                <td valign="top"><input name="DOBDay" type="text" id="DOBDay" size="3" required />
                    <select name="DOBMonth" id="DOBMonth" required>
                        <option value="01">January</option>
                        <option value="02">February</option>
                        <option value="03">March</option>
                        <option value="04">April</option>
                        <option value="05">May</option>
                        <option value="06">June</option>
                        <option value="07">July</option>
                        <option value="08">August</option>
                        <option value="09">September</option>
                        <option value="10">October</option>
                        <option value="11">November</option>
                        <option value="12">December</option>
                    </select> <input name="DOBYear" type="text" id="DOBYear" size="10" required />
                </td>
            </tr>
            <tr>
                <td align="right" valign="top">ID Number:</td>
                <td valign="top"><input name="IDNumber" type="text" id="IDNumber" size="40" /></td>
            </tr>
            <tr>
                <td align="right" valign="top">
                    <p>Professional Registration (if any) number and date: <span style="font-size: 10px"><br />
                            (e.g. PrEng, PrTechEng, Quantity Surveyor, Architect, CA(SA) etc; full Membership of Institutions etc)</span></p>
                </td>
                <td valign="top"><input name="ProfReg" type="text" id="ProfReg" size="60" /></td>
            </tr>
            <tr>
                <td align="right" valign="top">
                    <p>Qualifications:</p>
                </td>
                <td valign="top"><input name="Qual" type="text" id="Qual" size="60" /></td>
            </tr>
            <tr>
                <td align="right" valign="top">
                    <p>Field/s of Expertise:</p>
                </td>
                <td valign="top"><input name="Expertise" type="text" id="Expertise" size="60" /></td>
            </tr>
            <tr>
                <td align="right" valign="top">Active position in your company:</td>
                <td valign="top"><label>
                        <input name="Position" type="text" id="Position" size="60" />
                    </label></td>
            </tr>
            <tr>
                <td align="right" valign="top">Province:</td>
                <td valign="top"><label>
                        <select name="Province" required>
                            <option value="Eastern Cape">Eastern Cape</option>
                            <option value="Free State">Free State</option>
                            <option value="Gauteng">Gauteng</option>
                            <option value="KwaZulu-Natal">KwaZulu-Natal</option>
                            <option value="Limpopo">Limpopo</option>
                            <option value="Mpumalanga">Mpumalanga</option>
                            <option value="North West">North West</option>
                            <option value="Northern Cape">Northern Cape</option>
                            <option value="Western Cape">Western Cape</option>

                        </select>
                    </label></td>
            </tr>
            <tr>
                <td align="right" valign="top">&nbsp;</td>
                <td valign="top">&nbsp;</td>
            </tr>
            <tr>
                <td colspan="2" align="center"><label>
                        <input type="submit" name="act" id="act" value="Submit" />
                    </label></td>
            </tr>
        </table>
    </form>
    <script language="javascript">
        <?php
        if (isset($_POST["Designation"])) {
        ?>
            if (xobj = findObj('Designation')) {
                for (i = 0; i < xobj.options.length; i++) {
                    if (xobj.options[i].value == '<?php echo $_POST["Designation"]; ?>') {
                        xobj.selectedIndex = i;
                    }
                }
            }
        <?php
        }
        if (isset($_POST["FirstName"])) {
        ?>
            if (xobj = findObj('FirstName'))
                xobj.value = '<?php echo $_POST["FirstName"]; ?>';
        <?php
        }
        if (isset($_POST["Initials"])) {
        ?>
            if (xobj = findObj('Initials'))
                xobj.value = '<?php echo $_POST["Initials"]; ?>';
        <?php
        }
        if (isset($_POST["Surname"])) {
        ?>
            if (xobj = findObj('Surname'))
                xobj.value = '<?php echo $_POST["Surname"]; ?>';
        <?php
        }
        if (isset($_POST["TelNum"])) {
        ?>
            if (xobj = findObj('TelNum'))
                xobj.value = '<?php echo $_POST["TelNum"]; ?>';
        <?php
        }
        if (isset($_POST["CellPhone"])) {
        ?>
            if (xobj = findObj('CellPhone'))
                xobj.value = '<?php echo $_POST["CellPhone"]; ?>';
        <?php
        }
        if (isset($_POST["PersonalFax"])) {
        ?>
            if (xobj = findObj('PersonalFax'))
                xobj.value = '<?php echo $_POST["PersonalFax"]; ?>';
        <?php
        }
        if (isset($_POST["Email"])) {
        ?>
            if (xobj = findObj('Email'))
                xobj.value = '<?php echo $_POST["Email"]; ?>';
        <?php
        }
        if (isset($_POST["DOBDay"])) {
        ?>
            if (xobj = findObj('DOBDay'))
                xobj.value = '<?php echo $_POST["DOBDay"]; ?>';
        <?php
        }
        if (isset($_POST["DOBMonth"])) {
        ?>
            if (xobj = findObj('DOBMonth')) {
                for (i = 0; i < xobj.options.length; i++) {
                    if (xobj.options[i].value == '<?php echo $_POST["DOBMonth"]; ?>') {
                        xobj.selectedIndex = i;
                    }
                }
            }
        <?php
        }
        if (isset($_POST["DOBYear"])) {
        ?>
            if (xobj = findObj('DOBYear'))
                xobj.value = '<?php echo $_POST["DOBYear"]; ?>';
        <?php
        }
        ?>
    </script>
<?php
}
?>