Site Map Home This Page: contactform.php

Using the Contact Form Plugin

The contact form, as supplied. You can customize most elements.

The contact form plugin can be embedded into any Mara page, or even used as a footer on multiple pages if you wish. The small amount of php coding work required is best done by directly editing the page sourcecode rather than using the online editor.

Insert the following code into the page body:

<?php

setg('our_telephone','01 1234 567','contactus');
setg('domain_name','example','contactus');
setg('toplevel_domain','com','contactus');
setg('form_mail_account','webform','contactus');
setg('direct_mail_account','webform','contactus');
setg('subject','Website Enquiry','contactus');

include(plugin('contactus'));

contactus_drawform();

?>

That really is all that's needed for a basic form. The settings fields should be self-explanatory. Note that you modify the middle section of each, only.
The email address to which the form is sent, in this case, would be 'webform -at- example.com' - The @ symbol is added by the software.  

If you're not too familiar with php, just remember that it has to be typed exactly as shown,  and in particular, missing out any punctuation is likely to result in the entire webpage (not just the form) failing to load.

Once you have created your php code, you can add surrounding text or images in the online editor if you prefer. The php section will appear as red marker, and provided you don't delete that marker, all will be well. Note that since you are now editing a page containing a  script, you need to be logged on with at least Manager priveleges, and need to refresh the page if you've only just logged-on. .

Additional features:

To provide an alternative method of contacting you if the customer dislikes forms, php calls exist to add an email address, a link that launches an email program, and a telephone number as follows: 

echo  contactus_launch_mailclient('email us') ;
echo  contactus_show_email('this address') ;
echo contactus_show_tel('this number') ;

These will place these appropriate items in the page as required.  'This address' is the text which will be displayed as a hyperlink.

We do it this way so as not to give harvesting robots even the faintest smell of an email address, to get them all excited.
Since there are now concerns over phone numbers possibly being harvested by dodgy telesales outfits, it makes sense to protect that as well, although in this case we don't ask for a captcha response, just a mouseover will expose it.

You can also customise the text which appears at the top of the form, both on first appearance and after a successful send. 
Place the following in the settings section, which must be somewhere before the call to drawform().

setg('preamble','Please fill in this form if you wish to make an enquiry.','contactus');
setg('postscript','We expect to reply to enquiries within one working day.','contactus');

Here's an example of what the basic php code output looks like:


Please fill in this form if you wish to make an enquiry

Firstly, please prove you are human by entering the number described below as digits..
Anti-robot check:
*  
two   hundred  and  seventy

   

Name
*
Address

E-mail
*
Telephone

Message