3 # This form requires wfpl. See: http://jasonwoof.org/wfpl
5 # You'll need to set the following to a valid email address:
6 $GLOBALS['~form_name~_form_recipient'] = "fixme@example.com";
8 if(!file_exists('code/wfpl/template.php')) { die('This form requires <a href="http://jasonwoof.org/wfpl">wfpl</a>.'); }
9 require_once('code/wfpl/template.php');
10 require_once('code/wfpl/format.php');
11 require_once('code/wfpl/email.php');
13 function ~form_name~_get_fields() {
15 <!--~formats start~-->
16 $~name~ = format_~format~($_REQUEST['~name~']);
17 tem_set('~name~', $~name~);
19 return array(~php_fields~);
22 function ~form_name~() {
23 if(isset($_REQUEST['~always_field~'])) {
24 list(~php_fields~) = ~form_name~_get_fields();
26 if("you're happy with the POSTed values") {
27 # uncomment the following lines to save the values recieved to the
28 # database. You can use ~form_name~.sql to create the database table.
29 #require_once('db_connect.php');
30 #db_insert('~form_name~', '~db_fields~', ~php_fields~);
31 if($GLOBALS['~form_name~_form_recipient'] != "fixme@example.com") {
32 $to = $GLOBALS['~form_name~_form_recipient'];
33 if(isset($_REQUEST['email']) and valid_email($_REQUEST['email'])) {
34 $from = $_REQUEST['email'];
35 if($_REQUEST['name'] and ereg('^[a-zA-Z0-9_\' -]*$', $_REQUEST['name']) !== false) {
36 $from = "$_REQUEST[name] <$from>";
41 $subject = '~form_name~ form submitted';
42 $message = tem_run('~form_name~.email.txt');
45 email($from, $to, $subject, $message, $cc, $bcc);
47 tem_load('~form_name~.html');
52 # otherwise, we display the form again. ~form_name~_get_fields() has
53 # already put the posted values back into the template engine, so they will
54 # show up in the form fields. You should add some message asking people to
55 # fix their entry in whatever way you require.
61 # emulate run.php if it's not being used
62 if(!function_exists('run_php')) {
63 tem_load('~form_name~.html');