SimpleForm: Easy PHP multi-form email handler


Releasing a new version of my contact form script, this time under the name SimpleForm. It’s a nicer version of the previous one, re-written from the ground up and with a couple of new features. SimpleForm is basically meant to be an easy solution to handle one or many forms with little effort. It’s mainly focused on ease of use and rapid deployment.

simpleform

Current version: 1.1.4 7/31/09

These are a couple of it’s main features ( ver. 1.1.4 ):

* Multiform handler.
* Support for required fields.
* PHP email validation.
* Unobtrusive JavaScript function to pre-check form data ( 4KB file ).
* Lightweight, easy to use.
* Multilingual support.
* External configuration file that can reside outside the public folder.

View the demo Multiple Forms Download Fork

HOW DOES IT WORKS?

It’s very simple, first there is a configuration file where you define all of your website forms, by this I mean form title, form fields, form required fields and the location of each form. Then there are some snippets you have to add to your form page/s and thats all. SimpleForm takes care of pre-cheking the form fields with JS and then validating them with PHP, if it’s valid then it will send the email to the configured email address and return the user to the form page with a success message or otherwise, with an error message.

INSTALLING THE SCRIPT

These are the necessary steps to have it up and running ( requires PHP 5 ):

  1. Download SimpleForm ( ver 1.1.4 )
  2. Open sf-config.php and edit the necessary info.
  3. Upload sf-config.php to your host ( preferably outside the public folder ).
  4. Open simpleform.php and edit the variable $PATH_TO_CONFIG_FILE ( on line 24 ) with the path from simpleform.php to sf-config.php ( leave empty if it resides on the same folder ).
  5. Upload simpleform.php, simpleform.css and checkform.mini.js inside your public folder.
  6. Open your form page/s and add the necessary code snippets.

EDITING THE CONFIGURATION FILE SF-CONFIG.PHP

# ------------------------------------------------------------ #
// SIMPLEFORM CONFIGURATION								      //
# ------------------------------------------------------------ #
/* GENERAL CONFIGURATION
/////////////////////////////*/
// The name of the website/client. Example: "My Website".
$aSettings["szFrom"] = "";
// The email address that will receive the emails. Example: "me@myemail.com".
$aSettings["szRecipient"] = "";
/* The email address that will be used to send the emails. To work properly this has to be a real account
configured on the same server of the site. Example: "noreply@mywebsite.com". */
$aSettings["szFromEmail"] = "";
/* FORMS CONFIGURATION
/////////////////////////////*/
/* The next step is to configure the Form/s.
   You can add as many as you want. */
$aForms = array(
	1 => array( 									// FORM ID: 1
		"szFormTitle" => "",						// FORM TITLE - Example: "Contact Form"
		"szFormURL" => "",							// FORM URL ( users will be redirected to this page )
		"szFormRequired" => array(					/* REQUIRED FIELDS ( array of name attributes ) */
			"name",
			"email",
		),
		"aFormFields" => array( 					/* LIST OF FORM FIELDS AND THEIR OUTPUT NAME
 													  All input fields coming from the form should go here.
													  The first value is the name attribute used and the second value
													  on the right the name displayed on the outputted data.
													  Any required field that contains the word "email" will have
													  it"s value validated as an email address. */
		   	"name" => "First Name",
			"email" => "E-mail",
			"work_email" => "Work Email",
			"phone" => "Telephone",
			"-sep1" => "This is a separator",		/* This is a separator. Any variable starting with the sign "-"
														will act as a content separator. */
			"color" => "Color Option",
			"comments" => "Comments",
			"-sep2" => "This is Another separator",
			"newsletter" => "Subscribe to our Newsletter?",
			"interested[]" => "Im interested in",
			/* add more */
			)
	),
	2 => array(										/* Form 2. Same as above */
		"szFormTitle" => "",
		"szFormRequired" => array(),
		"szFormURL" => "",
		"aFormFields" => array(
			/* add more */
			)
	),
	3 => array(										/* Form 3. Same as above */
		"szFormTitle" => "",
		"szFormRequired" => array(),
		"szFormURL" => "",
		"aFormFields" => array(
			/* add more */
			)
		),
	/* add more */
);
/* RESPONSE CONFIGURATION
/////////////////////////////*/
/* Response Messages: These are the variables that hold the messages
the system prints as response. You can modify them to suit your project needs. */
 // Form has been sent.
$aSettings["aMessages"]["szSubmitSucess"]  = "Your message has been sent succesfully. Thanks!";
// Missing fields.
$aSettings["aMessages"]["szMissingFields"] = "Please complete all required fields.";
// Unvalid email address.
$aSettings["aMessages"]["szUnvalidEmail"]  = "Please insert a valid email address.";
// Email not sent by system error.
$aSettings["aMessages"]["szSystemError"]   = "There was an error in the system. Please try again later. Thanks!";
/* ADVANCED CONFIGURATION
/////////////////////////////*/
// Name of the GET variable to pass response messages
define( "GET_NAME", "response");
// Debug mode ( prints email content, and system errors )
define( "DEBUG_MODE" , false );
/* Check if the domain of the submitted email addresses exists.
False by default as it may bring problems with some servers. ) */
define( "CHECK_EMAIL_ADDRESS_DNS" , false );

INTEGRATING SIMPLEFORM WITH YOUR FORMS

Below you’ll find the things you need to do to your form page ( must be php file ) for SimpleForm to work. I also have included a full example at bottom.

A. Add Javascript and CSS files

Add simpleform.css and checkform.js ( or checkform.mini.js ) inside the <head> element:

	<link rel="stylesheet" href="simpleform.css" type="text/css" media="screen"/>
	<script type="text/javascript" src="checkform.mini.js"></script>
	

B. Define the path to the config file and Include simpleform.php in the document ( before your form/s ):

	<?php
	define( "CONFIG_PATH", "place/here/the/path/to/sf-congif/dir/" );
	require_once "simpleform.php";
	$sForm = new simpleForm();
	?>
	

C. Add SimpleForm Responses function

Prints the systems response and can reside anywhere on the document.

			<?php
 		   	// Example: <p class="message-box error">Please insert a valid email address.</p>
 		   	$sForm->handleMessage(); ?
 		   	>
		

Output example:

Please insert a valid email address.

D. Add SimpleForm Form function

This function generates the required hidden input fields for simpleForm to work. The value passed is the ID assigned to the current form in the configuration file. This function must reside in between the <form></form> elements.

 <?php
 //Prints necessary data for the form with the ID = 1
$sForm->printData(1);
?>

E. Edit the <form> attributes:

Point the form’s action attribute to simpleform.php and then add the checkform function to enable the js data pre-checking.

	<form action="simpleform.php" method="post" onsubmit="return checkform(this)">
	

The checkform() function supports an optional string parameter which alters the text you
want to display on the js alerts. The variable #name is provided as a wildcard for the field Name.

Examples:
“Please complete the field #name”
“The field #name is missing”
“Por Favor complete el campo #name”

				onsubmit="return checkform(this,'The field #name is missing')"
				

Full Example

	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
		<html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
			<title>SimpleForm Example</title>
			<link rel="stylesheet" href="simpleform.css" type="text/css" media="screen"/>
			<script type="text/javascript" src="checkform.mini.js"></script>
		</head>
		<body>
			<?php
			define( "CONFIG_PATH", "../secure/" );
			require_once "simpleform.php";
			$sForm = new simpleForm();
			$sForm->handleMessage();
			?>
			<form action="simpleform.php" method="post" onsubmit="return checkform(this)">
		 	<fieldset>
		 	<?php $sForm->printData(1); ?>
				<legend>Personal Details:</legend>
		        <label for="name" >Name</label>
		        <input name="name" id="name" type="text" value="" />
		        <label for="email">Email <span class="required">(required)</span></label>
		        <input name="email" id="email" type="text" value="" />
				<label for="work_email">Work Email</label>
		        <input name="work_email" id="work_email" type="text" value="" />
				<label for="phone">Telephone <span class="required">(required)</span></label>
		        <input name="phone" id="phone" type="text" value="" />
		        <label for="color">Color Options: <span class="required">(required)</span></label>
		        <select name="color" id="color">
					<option value="-">Choose a color</option>
					<option value="Red">Red</option>
					<option value="Green">Green</option>
					<option value="Blue">Blue</option>
				</select>
		        <label for="comments">Comments</label>
		        <textarea name="comments" id="comments" rows="10" cols="50"></textarea>
		        </fieldset>
		        <fieldset class="radio">
		            <legend>Subscribe to our Newsletter? <span class="required">(required)</span></legend>
		            <label><input type="radio" name="newsletter" value="Yes" /> Yes</label>
		            <label><input type="radio" name="newsletter" value="No" /> No</label>
		        </fieldset>
				<fieldset class="checkbox">
		            <legend>Im interested in: <span class="required">(required)</span></legend>
		            <label><input type="checkbox" name="interested[]" value="Arts" /> Arts</label>
					<label><input type="checkbox" name="interested[]" value="Science" /> Science</label>
					<label><input type="checkbox" name="interested[]" value="Sports" /> Sports</label>
		        </fieldset>
		        <p><button type="submit">Submit this!</button></p>
		    </form>
		</body>
		</html>
View the demo Mutiple Forms Download

RELEASE NOTES

ver 1.1.4 – Another Email Bug fixed ( Courtesy of megabonez ).
ver 1.1.3 – Email Bug fixed ( Mayor thanks to Jim from cpscreative.com ).
ver 1.1.2 – Minor Bugs fixed.
ver 1.1.1 – Optional Email DNS checking.
ver 1.1 – Easier path deployment, Configurable response variable name, Debug function and minor bug fixes.
ver 1.0 – First Release.

Reactions (82)

  1. Pingback SimpleForm: easy PHP multi-form email handler | Webmaster Tools

  2. Charles

    Matt,

    Does the email validation support the “+” character, or will it fail validation like so many other incorrect email validation scripts?

    Thanks

    • Hi Charles, yes it does validate emails with the plus character. Thanks for the comment!

  3. I just broke the email validation. I first entered mail@mail.no and filled out the rest of the form. Then I went back up to the email, and removed “no”, so it said “mail@mail.” and it passed trough the validation :)

  4. Pingback PHP SimpleForm Script » Matt Varone » Creative Designer - 【23php】

  5. Pingback PHP SimpleForm Script » Matt Varone » Creative Designer

  6. Pingback SimpleForm: easy PHP multi-form email handler | Lively Web Tuts

  7. Pingback Posts about XHTML as of April 17, 2009 | XHTML and CSS

  8. Is it possible to customize/change the above form with additional fields and get this script work with them?

    • Hi Avaz, yes absolutely, the script supports as many fields and forms as you want. Build your form from the ground up and once done modify “sf-config.php” with the name attributes of your form. For example, lets say you built this form:


      <form action="simpleform.php" method="post" onsubmit="return checkform(this)">
      <?php $sForm->printData(1); ?>

      <label for="price" >Price</label>
      <input name="price" id="price" type="text" value="" />
      <label for="amount" >Amount</label>
      <input name="amount" id="amount" type="text" value="" />

      <p><button type="submit">Order</button></p>
      </form>

      Then on ‘sf-config.php‘ you would configure the form incoming fields:


      1 => array(
      "szFormTitle" => "My Order Form",
      "szFormRequired" => array("price","amount"),
      "szFormURL" => "order.php",
      "aFormFields" => array(
      "price" => "Product Price",
      "amount" => "Amount",
      )
      ),

      You can change the fields and required fields at any time, making it really easy to update the script. Of course you have to also follow the steps mentioned in the post above to make sure it will work correctly. Let me know if you still having doubts

  9. Jitendra Vyas

    Can i get all mail through this form into my free gmail account or php mailer needed. ?

    • Hi Jitendra. I’m not sure what you mean about php mailer, but aside from that, yes you can point the form to your free gmail account.

  10. Hi Matt,
    Thanks for this script. I’m kind of a newbie-intermediate with php. I’ve tried your script (the whole sample folder) after editing the necessary field. I get the email but it doesn’t pass the values from the checkboxes. Any ideas on this?

    Another quick questions. I’ve tried your script on a different server (for my work) but I keep getting this error when I submit
    PHP Fatal error: Call to undefined function checkdnsrr() in D:\inetpub\wwwroot\_newsite\sample\simpleform.php on line 224

    I’m really not sure how to fix this error.
    Thanks for any help.

    • Hi E11World, glad you like SimpleForm. Please download the new version, It nows comes with the DNS check off by default. As for the checkboxes values it was a little code mistake I made on the last update. So this new one should fix it. Thanks for the comment!

    • Hi Shahriat, Thank you. I look forward improving the js pre-validation although I really want the keep the file size relatively small. Any suggestion are welcomed.

  11. Thanks for this new version Matt. Everything worked except for one thing which I think could be differnt (if I understood it right).
    After I hit submit, the page redirects to index.php or any page I want. If I leave it blank, it shows me a blank page.
    Before you had it so it gives you the Sent Message on the same page. Is that not available in this version or is it just not working right for me?
    I did change the $bDisplay = false; to $bDisplay = true; but it didn’t help. I don’t know what else to try now.

    • You are welcome, thanks for the feedback and also for downloading the new version. As for the Sent Message, if I understood correctly what you ask, simpleForm will always show the response messages after it redirects the user to the form page specified in "szFormURL" => "formpagenamehere.php" variable ( found on the sf-config.php file). Let me know if that helps or if you are referring to something else. Thanks again!

  12. I guess I explained it wrong then. I don’t get any response message after submitting. It just goes to the page specified in the szFormURL. I guess something did go wrong for this not to show the message before redirecting.
    How about just leaving the user on the page after they get the message?

  13. My bad Matt. I didn’t know that I was suppose to put the same page’s url there to do that. Now it works.
    Another improvement I would suggest for this is, when the user gets an error, to re-populate all the fields with there values that the user entered instead of reseting them to blank.

  14. Pingback SimpleForm: Formulario de contacto | Eliseos.Net

  15. Great script! Thanks for sharing. You might want to mention that it requires PHP 5. I initially had it testing on one of my subdomains running PHP 4 and it wouldn’t run at all…

  16. First of all, thanks for sharing the script! I’ve found something probably usefull in case someone else is having the same problem as me.
    I was trying to make it work, but it didn’t sent the emails until I changed the php ‘safe mode’ on the server configuration. Aparently it has to be off if you want the script to work properly.

  17. Hey Matt – Just wondering if you can recommend a good web host to use this with? I’m using Dotster and, even when inputting a valid email address associated with our account, I’m getting the error message – but at the same time I’m receiving the email.

    Thanks!

    • Hi Jon, I have used this script across several hostings ( mosso, dreamhost, ixwebhosting, and others ) without problems. Is your server running PHP5?

  18. Brian Miller

    Hi Matt,
    First want to thank you for posting this great form!

    In comparing what I’ve got working on my site and what you have on your demo page, I have a question about the response message.

    If the user does not complete a required field, your demo highlights that field in red and displays a pop up message explaining the field is required.

    On my site, if the user does not complete a required field the field box will highlight in red for a split second then I am redirected back to the same page (which I’ve specified, “szFormURL” => “contact.php”,) and the message is displayed above the form. However the required field boxes are no longer highlighted in red?

    Is there anyway to keep the red highlighted boxes on the redirected ?response=2 page?

    http://styleatile.com/contact.php

    Thanks!

    • Hi Brian, glad you like SimpleForm. From what I saw, I’m guessing that you haven’t updated the required fields array in sf-config.php ( szFormRequired ) to match your form required fields. This is causing the JS script to search for a color,newsletter and interested[] field which don’t exists in your form thus skiping and giving an error. Hope that helps you,
      Thanks for the comment!

  19. Francis

    Hey. I like your CSS used in this script. It is wonderful. I keep getting this error when I run the script “There was an error in the system. Please try again later. Thanks!” Please what could be the problem?

    • Hi Francis, thank you for the comment. Have you checked the php version you are running? It must be php5 for SimpleForm to work correctly. Thanks!

  20. Martin

    Hi Matt!

    Thanks for sharing but I’m a little confused… Firstly, why are there are two parts to the validation? JS and PHP – if i remove checkform.js, the PHP still validates and the user is presented with the more friendly css styled message – rather than the not so friendly JS message box.

    Personally, i prefer the php validation – am i right in thinking i can just remove the checkform.js?

    Secondly, whilst using only php validation – i am trying to make the form sticky, and failing miserably… I am using the following within the HTML form: (this is for the ‘name’ field)

    value=””

    So the whole input line becomes:

    <input type=”text” name=”name” id=”Name” value=”” />

    But for the life of me, can’t work why it’s not working…

    Any suggestions would be greatly appreciated!

    Many thanks!

    • Hi Martin, thank you for the comment and sorry for the delay. What you mean by making your form sticky? You are correct you can use it without js validation, although users will get to fill the form again if they enter wrong data as it will reload the page to check the inputed data via php. Cheers!

  21. megabonez

    Hey Matt,

    First off, thanks for the great scripts. I love your subscribe and unsubscribe script, it was a joke to install and edit to my specifications (added an image echo when email was submitted so the form and buttons get covered).

    As for this contact form, I was wondering, how would I go about by storing the form data in a database as well as emailing it.

    Thanks in advance

  22. I found a problem in a couple routines where you are using aSettings[‘szFrom’] instead of this->aSettings[‘szFromEmail’] which results in a weird sender. The functions are in simpleform.php: declareHeaders() and sendEmail(). I modified them as follows:

    Line 285:
    $this->szHeaders = ‘From: ‘ . $this->aSettings[‘szFrom’] . “aSettings[‘szFromEmail’] . “>” . “\r\n”;

    Line 291:
    if( mail( $this->aSettings[‘szRecipient’], $this->aSettings[‘szFrom’]. ‘aSettings[‘szFromEmail’] . ‘>: ‘.$this->aForm[‘szFormTitle’], $this->szContent, $this->szHeaders, ‘-f’ . $this->aSettings[‘szFrom’]. ‘aSettings[‘szFromEmail’] . ‘>’ ) )

  23. Forgot to say first off, great script! :-) Just jumped right to the issues. Sorry about that!

    • Dear Jim, Thanks for pointing that out, can’t believe I didn’t noticed.
      Just fixed the issue and updated SimpleForm to 1.1.3 please download it again.
      Thanks again!

  24. Seriously Brilliant, well put together stuff. Thankyou!

  25. megabonez

    Hey Matt,

    Great script again. I believe I caught an error on your most recent change.

    simpleform.php line 291:
    if( mail( $this->aSettings[‘szRecipient’], $this->aSettings[‘szFromEmail’].’: ‘.$this->aForm[‘szFormTitle’], $this->szContent, $this->szHeaders, ‘-f’ . $this->aSettings[‘szFromEmail’] ) )

    this should be:
    if( mail( $this->aSettings[‘szRecipient’], $this->aSettings[‘szFrom’].’: ‘.$this->aForm[‘szFormTitle’], $this->szContent, $this->szHeaders, ‘-f’ . $this->aSettings[‘szFromEmail’] ) )

    Basically, this was causing the subject line of the email to be “[from email]: [form title]” instead of “[from]:[form title]”

    Also, do you know of any fairly easy ways to record the data in a database?

    Thanks,
    -A

  26. Thanks for everyone who been contributing and Megabonez for the new bug heads up, the script has been patched and re uploaded.

    As for storing the emails on a database, the best solution would be to create a new private method in the SimpleForm class that loops trough the fields array and then stores this information into the database. The adequate place to call it would be only once the email is sent, ( private method sendEmail() ) as probably you want to save only successful emails. I can’t promise this will be a future add on, but will consider to include it in next versions.

    Thanks again

  27. Pingback 3 Scripts PHP para trabajar con formularios HTML | pixelco.us blog

  28. thanks for providing this script. I’ve been looking for something that is this simple and pretty for a few days now… he sample code is also very helpful :)

  29. Pingback SimpleForm: Easy PHP multi-form email handler « developer news

  30. this form is awesome!

    how will this handle multiple recipients?

  31. It would be cool, if fields could also be checked on numbers only, or for zipcodes, a special regex should be there as well as for text-only fields.

  32. Hello!

    I am trying to implement the simpleform.php (which I have done successfully on other sites), and I am getting the following error:

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in [path name to simpleform.php]

    When I did a search I found at least 2 other websites out there with the same error message coming up related to this script.

    Any ideas of what setting I have wrong?
    Thanks!!

  33. Hi,very good script,congratz.

    I have a question… there is a way to put client mail on szfromEmail or something like that,simply for press reply button on client mail and not to click on email.

    Thank you and sry for my english(im spanish).

  34. @Amanda:
    Sounds like you’re running PHP4 on your Server!?

  35. Hi Matt, do you have a tut for the contact form? I am really new to all this and I just can’t seem to get things in order. Thank you!

    – Achalla

  36. Hi Matt! I wondering is it possible to implement that form into WordPress? I have some problems with that?

  37. letterheads

    Interesting post – you’ve done a thorough job :)

  38. Hi! Thanks for your work! I think that there are bug with checking fields when putting two radio input! Try in sample form change the last checkbox to radio and you’ll see it.

  39. Hi Matt,

    Your form is really helpful for front end developers like me that don’t know much about PHP.

    I have been using your script on a couple of projects already. But I wanted to know if its is possible to make two form fields to match each other, for example the two email address fields should have the same value.

    Thank you.
    Mick

  40. Dylan

    Great work Matt and thank you. The scripts are just awesome. It just work with minimum configuration, whats else could anyone ask for. Just one question, what or rather where do we can change in the code if I want the output (send to email) to be change into HMTL based email, instead of the normal text base? Basically what I wanted to do is change the layout of the receiving email from just pure text to html based.

    Again great work and thank you.

  41. Matt, Great script but I have been running into an issue when my form has 2 or more required occurances of either radiobuttons or checkboxes. The first occurance will be validated and notify the user that the field is require. On the second and subsequent occurances the script completely skips over that form field. The same happens with checkboxes. The first is validated and remaining checkboxes are skipped.
    I would appreciate any help you can give in finding the bug.
    Thanks

  42. Hi, I’d love to get your script working.

    I have my form (contact.php) the simpleform.php and sf-config.php in the folder on my server. Server is running PHP 5.2.13.

    I can’t submit an email without triggering the “Please insert a valid email address.” message, even though the email adresses are real.

    Can you advise?

  43. Fogret my last comment – I didn’t have the correct attributes in my form input tags.

    Thanks Matt for the great script, you fine fellow.

  44. Ericman

    Hello matt, this script is excelent but i need the posibility to attacht a file a send an email,
    Can you help me about that?

    Thanks a lot,

    Eric

  45. Is there a way to integrate a CAPTCHA feature to your Simple Form?

  46. Efe Buyuran

    Greetings Mat, your form is actually quite complicated to intergrate but I’ve managed to modify your already working sample files. Thanks alot.

  47. Efe Buyuran

    Correction: Form does NOT work on WordPress. It just gives this error.

    SimpleForm config file missing. Missing SimpleForm configuration values. Please check your settings. The form requested can’t be found.

    • @Efe To use it in WordPress try the following on the template file where you have the form:


      define('CONFIG_PATH', TEMPLATEPATH .'/' );
      include_once ( TEMPLATEPATH . '/simpleform.php' );
      $sForm = new simpleForm();

      Place both simpleform.php and sf-config.php on your theme’s folder and whoa-la

  48. This is a great script. Very simple and easy to use! However, I’m bumping into a small problem that I just can’t seem to wrap my head around…

    SimpleForm is working wonderfully for me, except that javascript validation warnings are popping up in an alert box instead of within my document where I’ve put the handleMessage(); function. After the form is filled out correctly, the successful delivery message shows up in the appropriate place. I’m baffled.

  49. Hey Matt, I was wondering if there is a way I can specify where the status messages display. Right now it automatically echos the message-box at the very top of the page. This is pretty inconvenient with my design and I would like it to echo inside of the div I have the form in. I’m beginner-intermediate at PHP so this may be a dumb question but Google didn’t help me much here, haha.

  50. Stephen Clark

    I was checking out your PHP Simple Form contact form script. I am self taught PHP so still figuring out the language.

    I was trying to upload the files to test it out and I keep on getting the following error.

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /nfs/c03/h03/mnt/55575/domains/alisadesigns.com/html/test/contact/sample/simpleform.php on line 42

    I downloaded the files directly from your site, did not change anything except configuring the “sf-config.php” file and putting the “sf-config.php” file in the folder /data/contact/

    I am using PHP 5. The site is hosted on MediaTemple.

    Am I doing anything wrong?

  51. Hi matt,

    Great Article. Thanks for sharing with us

    Thanks & regards

    Jacob

  52. This is really helpful reference for someone who doesn’t know any Php, so simple to apply and follow the instruction, Very nicely done.

  53. darious

    Dear Matt
    Fantastic script! great work, cuppa tea en route… how would I change the script to have a user drop-down for different recipients of the mail?

  54. I’d like to customize the subject line of the email that arrives from the form so that is says (for example):

    “[from]:[form title] – [name]”

    Any help would be appreciated.

  55. Hello.. why this erorr?? Warning: mail() [function.mail]: SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE in /home/ayieblog/public_html/kolejkk.co.cc/form/simpleform.php on line 291

    Warning: Cannot modify header information – headers already sent by (output started at /home/ayieblog/public_html/kolejkk.co.cc/form/simpleform.php:291) in /home/ayieblog/public_html/kolejkk.co.cc/form/simpleform.php on line 303

  56. Hi, thank you so much for your fantastic-written SimpleForm plugin and brilliantly clear explanation. I’ve been trying to get my contact form sorted out for nearly 3 days now until I found yours (I’m just a starter). Well the problem is I’m using XAMPP at the moment as a testing server try sending myself a message from my contact form to the XAMPP but then got Error 404 after the test. I’m sure that I must have done something wrong on my end. Do you know any thing about getting things work between your script and XAMPP?
    Two questions though:
    1. What my path should be as sf-config.php is stored in C:\xampp\htdocs\mywebsite

    2. I set >> $aSettings[“szRecipient”] = “admin@localhost”; ??

    There’s nothing else I could think of that caused the error.

  57. sparky j

    Hi Matt,
    looks great. Would love to use….
    Does this mean this form will only work if it is redirecting to its own page?
    I actually need to open this with a jquery “show-hide’ effect.

    Does it need its own page. Sorry. A total newb here.

    “szFormURL” => “”, // FORM URL ( users will be redirected to this page )