- if(!$edit_id && !$delet_id) {
- tem_sub('new_msg');
- }<!--~end~-->
-
- if(isset($_REQUEST['~always_field~'])) {
- list(~php_fields~) = ~form_name~_get_fields();
-
- if("you're happy with the POSTed values") {<!--~opt_db_4 start~-->
- if(file_exists($db_connector = 'db_connect.php') || file_exists($db_connector = 'code/db_connect.php')) {
- require_once($db_connector);
- if($edit_id) {<!--~image_db start~-->
- # uploading nothing means leaving it as is.
- if(!$~name~ && $delete_~name~ != 'Yes') {
- $~name~ = db_get_value('~form_name~', '~name~', 'where id=%i', $edit_id);
- }
- <!--~end~-->
- db_update('~form_name~', '~db_fields~', ~php_fields~, 'where id=%i', $edit_id);
- message('Entry updated.');
- } else {
- db_insert('~form_name~', '~db_fields~', ~php_fields~);
- message('Entry saved.');
- }
- }<!--~end~--><!--~opt_email_2 start~-->
- if($GLOBALS['~form_name~_form_recipient'] != "fixme@example.com") {
- $to = $GLOBALS['~form_name~_form_recipient'];
+ if(!$edit_id) {<!--~opt_listing {~-->
+ if(!isset($_REQUEST['~file_name~_new']) && !isset($_REQUEST['~always_field~'])) {
+ $listing_rows = db_get_assocs('~table_name~', 'id<!--~listing_fields_1 {~-->,~name~<!--~}~-->', 'order by ~always_field~ limit 100');
+ tem_set('listings', $listing_rows);
+ return;
+ }
+<!--~}~-->
+ tem_set('new_msg');
+ }
+<!--~}~-->
+ if(isset($_POST['~always_field~'])) {
+ $data = ~file_name~_get_fields();
+
+ if("you're happy with the POSTed values") {<!--~opt_db {~-->
+ if($edit_id) {
+ db_update_assoc('~table_name~', $data, 'where id=%i', $edit_id);
+ message('~singular cap~ updated.');
+ } else {
+ db_insert_assoc('~table_name~', $data);
+ message('~singular cap~ saved.');
+ }<!--~}~--><!--~opt_email {~-->
+ if($GLOBALS['~file_name~_form_recipient'] != 'fixme@example.com') {
+ $to = $GLOBALS['~file_name~_form_recipient'];
+ $from = 'noreply@~this_domain~';
+ $reply_to = $to;