Lesson 08: Creating Contact Forms

The basic contact form example uses the [[EMAIL]] shortcode to send a response to the website admin or any other email address that you choose..

The email shortcode looks like this.

[[EMAIL:$to|$from|$subject|$message]]

Create a node and paste this following code into it’s landing page editor. Substitute your own email address in the code for testing. Goto the node’s address and test with browser.

[[IF_SUBMITTED]]
 [[POST:First_Name]]
 [[POST:Last_Name]]
 [[POST:Email_Address]]
 [[POST:Message]]
 [[INITIALIZE:to|"admin@yoursite.com"]]
 [[INITIALIZE:body|$First_Name.$Last_Name.$Message]]
 [[INITIALIZE:subject|"response from contact form"]]
 [[EMAIL:$to|$Email_Address|$subject|$body]]
 Thank you [[PRINT:First_Name]] [[PRINT:Last_Name]], your message has been sent[[cr]]
[[ELSE]]
 Here is the contact form.[[cr]][[hr]]
 [[FORM:#this]]
  [[INPUT:First_Name|Enter Your First Name]]
  [[INPUT:Last_Name|Enter Your Last Name]]
  [[INPUT:Email|Enter Your Email Address]]
  [[INPUT:Message|Enter Your Message]]
  [[SUBMIT:Save]]
 [[END_OF_FORM]]
[[END_IF]]

Leave a Reply