addElement('header', 'hdrTesting', 'Submit Link'); $form->addElement('hidden', 'languages', '1'); $feld=&HTML_QuickForm::createElement('select','cat_id','Category'); $query="select id,name from bo_category WHERE parent_id = 1 order by name"; $feld->load($db,$query,"name","id"); $form->addElement($feld); $form->addElement('text', 'field26_lang1', 'Site Title'); $form->addElement('textarea', 'field27_lang1', 'Description'); $form->addElement('text', 'field28_lang1', 'URL'); $form->addElement('text', 'field29_lang1', 'Email'); $form->addRule('field29_lang1', 'Email is required', 'required'); $form->addRule('field29_lang1', 'A valid Email adress is required', 'email'); $form->addElement('textarea', 'field30_lang1', 'Your Site\'s Link Page'); $form->addElement('textarea', 'field31_lang1', 'Further Information'); $form->addElement('reset', 'btnClear', 'Clear'); $form->addElement('submit', 'btnSubmit', 'Submit'); if ($form->validate()) { // Form is validated, then processes the data $form->freeze(); $form->process('process_data', false); $smarty->assign( 'main_tpl', 'webmasters_thanks' ); } else { // Create the renderer object $renderer =& new HTML_QuickForm_Renderer_ArraySmarty($smarty); $renderer->setRequiredTemplate( '{if $error} {$label} {else} {$label} {if $required} * {/if} {/if}' ); $renderer->setErrorTemplate( '{if $error} {$error}
{/if} {$html}' ); $form->setRequiredNote( ' This field is mandatory'); // build the HTML for the form $form->accept($renderer); // assign array with form data $smarty->assign('form_data', $renderer->toArray()); $smarty->assign( 'main_tpl', 'webmasters' ); } function process_data ($values) { $values[name] = $values[field26_lang1]; $values[field58_lang1] = $values[field26_lang1]; $values[field55_lang1] = $values['cat_id']; //print_r( $_REQUEST ); $link_id = add_item( $values ); // Send an email to show this item has been added require( BASE_PATH . '/include/site/class.phpmailer.php' ); $mail = new PHPMailer(); $mail->From = "noreply@luxurypropertyrentals.com"; $mail->FromName = "Luxury Destinations Web Site"; $mail->AddAddress("beverley@rhodeschoolofcuisine.com", "Beverley Ellis"); $mail->AddBcc("julianf@digitalbakery.net", "Julian Fricker"); $mail->AddBcc("david.abernethy@lineone.net", "Dave Abernethy"); $mail->Subject = "New Link Added"; $body = "You can access the details of this new link here:\n"; $body .= SITE_URL . "admin/item/?mode=edit&id=" . $link_id . "\n\n"; $link_info[Title] = $values[field26_lang1]; $link_info[Description] = $values[field27_lang1]; $link_info[URL] = $values[field28_lang1]; $link_info[Email] = $values[field29_lang1]; $link_info[Reciprocal] = $values[field30_lang1]; $link_info[Info] = $values[field31_lang1]; foreach( $link_info as $key => $value ) { if( $value != "" && $key != "Submit" ) { $body .= $key . ": " . $value . "\n"; } } $mail->Body = $body; $mail->Send(); } // Call the function to get the required page data from that database get_page_data( $smarty, $db ); $smarty->assign( 'side_tpl', 'sidebar' ); display_simple_tpl( TEMPLATE_PATH.TEMPLATE_GENERIC_DIR. "site.tpl" ); ?>