Free Contact Form
Looking for a free way to add a contact form to your Pligg website? This article provides instructions on how to add a contact form to your Pligg website in 3 easy steps. This contact form is based on one provided by 1stwebdesigner.com. It is a very basic contact form that can be tweaked to suit your own purposes.
We will be utilizing Pligg’s page feature to create the contact page. Pages can be added by logging into the Pligg Admin Panel, then navigate to Manage > Pages > Submit a New Page. Set the page title, url, and other values to whatever you want. In the main content field, add the code below.
<form action="mail.php" method="POST"> <p>Name:</p> <input type="text" name="name" size="40"> <p>Email:</p> <input type="text" name="email" size="40"> <p>Concerning:</p> <select name="type" size="1"> <option value="General Comment">General Comment</option> <option value="Bug Report">Bug Report</option> <option value="Advertising Inquiry">Advertising Inquiry</option> </select> <br /> <p>Message:</p><textarea name="message" rows="6" cols="50"></textarea><br /> <input type="submit" value="Send"><input type="reset" value="Clear"> </form>
Next you should create a landing page that users will be directed to after they submit the contact form. Create a basic “Thank you” message on a new Pligg page. Copy down the URL to this new page because you will be using it in the next step.
Create a new file and name it “mail.php”. Copy the data below into the new mail.php file, making changes to the recipient (what email receives the email) and header lines. The header URL should point to the “Thank you” page that you created on step 2.
<?php $name = $_POST['name']; $email = $_POST['email']; $type = $_POST['type']; $message = $_POST['message']; $formcontent=" From: $name ($email)\n Type: $type \n Message: $message"; // Change to your email address $recipient = "SAMPLE@SAMPLE.COM"; // The subject of the email being sent to you $subject = "Contact Form"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); // Point to the contact success page URL header( 'Location: http://pligg.com/demo/page.php?page=contact-success' ) ; ?>
When you finish making the edits upload the mail.php file to the root of your Pligg website. All you have to do now is test the contact form to make sure that it works, and then post a link to the contact page by manually adding it to one of your template files. Congrats, you now have an email contact form on your website!