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');
12 #require_once('code/wfpl/db.php'); # fixme
14 function ~form_name~_get_fields() {
15 $GLOBALS['~form_name~_fields'] = array();<!--~formats start~-->
17 $value = format_~format~($_REQUEST['~name~']);
18 tem_set('~name~', $value);<!--~db_field start~-->
19 $GLOBALS['~form_name~_fields'][] = $value;<!--~end~--><!--~end~-->
23 if(isset($_REQUEST['~always_field~'])) {
24 ~form_name~_get_fields();
26 if("you're happy with the POSTed values") {
27 #db_insert('~form_name~', '~db_fields~', $GLOBALS['~form_name~_fields']); # fixme
28 if($GLOBALS['~form_name~_form_recipient'] != "fixme@example.com") {
29 $to = $GLOBALS['~form_name~_form_recipient'];
30 if(isset($_REQUEST['email']) and valid_email($_REQUEST['email'])) {
31 $from = $_REQUEST['email'];
32 if($_REQUEST['name'] and ereg('^[a-zA-Z0-9_\' -]*$', $_REQUEST['name']) !== false) {
33 $from = "$_REQUEST[name] <$from>";
38 $subject = '~form_name~ form submitted';
39 $message = tem_run('~form_name~.email.txt');
42 email($from, $to, $subject, $message, $cc, $bcc);
44 tem_load('~form_name~.html');
49 # otherwise, we display the form again. ~form_name~_get_fields() has
50 # already put the posted values back into the template engine, so they will
51 # show up in the form fields. You should add some message asking people to
52 # fix their entry in whatever way you require.
55 tem_load('~form_name~.html');