X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=metaform%2Ftemplate.php;h=5a5c0eeb00bd0fea4feae02f9ecf679fd793d711;hb=c4e3ec54f995df5a6db8c497fb826f0d21d35cbc;hp=2755101876c54069c06573f6a35d02a2381ad5bc;hpb=2eab32b23556a89b3190e208b88c1fd3bec4eb4d;p=wfpl.git diff --git a/metaform/template.php b/metaform/template.php index 2755101..5a5c0ee 100644 --- a/metaform/template.php +++ b/metaform/template.php @@ -7,7 +7,11 @@ # To send results by e-mail, all you have to do is set your e-mail address here: $GLOBALS['~form_name~_form_recipient'] = "fixme@example.com"; - + +# Set this to the path to your uploads directory. It can be relative to the +# location of this script. IT MUST END WITH A SLASH +$GLOBALS['upload_directory'] = 'uploads/'; + # To save results to a database, you'll need to create the ~form_name~ table # (the file ~form_name~.sql should help with this), and create a file called # 'db_connect.php' which calls db_connect() see: @@ -17,23 +21,25 @@ if(!file_exists('code/wfpl/template.php')) { die('This form requires + # uploading nothing means leaving it as is. + if(!$~name~ && $delete_~name~ != 'Yes') { + $~name~ = db_get_value('~form_name~', '~name~', 'id = %"', $edit_id); + } + db_update('~form_name~', '~db_fields~', ~php_fields~, 'id = %"', $edit_id); tem_set('did', 'updated'); } else { @@ -86,15 +97,16 @@ function ~form_name~() { # already put the posted values back into the template engine, so they will # show up in the form fields. You should add some message asking people to # fix their entry in whatever way you require. - } } elseif($edit_id) { # we've recieved an edit id, but no data. So we grab the values to be edited from the database - list(~php_fields~) = db_get_row('events', '~db_fields~', 'id = %"', $event_id); - ~tem_sets~ + list(~php_fields~) = db_get_row('~form_name~', '~db_fields~', 'id = %"', $edit_id); + ~tem_sets.tab~ } else { # form not submitted, you can set default values like so #tem_set('~always_field~', 'Yes'); - } + } + + tem_set('upload_max_filesize', upload_max_filesize()); tem_sub('form'); }