echo '<div id="inset">If this address is incorrect please <a href="javascript:cancelResponse();">try again</a></div>'; echo $form->renderForm(); exit; } elseif ($lookup_type == "manual") { // make the form $formData = array($scope . '_pcid' => array('type' => 'hidden', 'value' => '-1'), $scope . '_addr1' => array('type' => 'text', 'label' => 'House Number', 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_addr2' => array('type' => 'text', 'label' => 'Building Name', 'required' => 1, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_addr3' => array('type' => 'text', 'label' => 'Street', 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_addr5' => array('type' => 'text', 'label' => 'City or County', 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), $scope . '_postcode' => array('type' => 'text', 'label' => 'Postcode', 'required' => 2, 'attributes' => array('class' => 'pc', 'maxlength' => 9), 'function' => 'format_postcode'), $scope . '_country' => array('type' => 'select', 'label' => 'Country', 'value' => $default_country, 'required' => 2, 'options' => db_lookup("pro_country", "country", "array"), 'attributes' => array('class' => 'addr'))); $form = new Form(); $form->addData($formData, $_GET); $formName = "form2"; $form->addHtml($form->addDiv($form->makeField("submit", $formName, "", "Save Changes", array('class' => 'submit')))); echo '<div id="inset">If this address is incorrect please <a href="javascript:cancelResponse();">try again</a></div>'; echo $form->renderForm(); exit; } else { $Data = $postcode->lookup($lookup_type, $search_string, "data"); if (count($Data) == 1) { foreach ($Data as $keyd => $data) { $udprn = $data["id"]; } header("Location:?lookup_type=udprn&search_string=" . $udprn . "&scope=" . $scope); exit; } else { $form = new Form(); $form->addHtml($form->addLabel("select", "Select Property", $postcode->output_list($Data))); $buttons = $form->makeField("button", "button", "", "Use Selected", array('class' => 'submit', 'onClick' => 'ajax_select_address(this.id);')); $buttons .= $form->makeField("button", "tryagain", "", "Try Again", array('class' => 'button', 'onClick' => 'cancelResponse();')); $form->addHtml($form->addDiv($buttons)); echo $form->renderForm(); exit; } }