"; } } $subject = 'tasks form submitted'; $message = tem_run('tasks.email.txt'); $cc = ''; $bcc = ''; if(email($from, $to, $subject, $message, $reply_to, $cc, $bcc)) { message('Due to an internal error, your message could not be sent. Please try again later.'); $error = true; } } if($error !== true) { return './'; } } # otherwise, we display the form again. tasks_get_fields() has # 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($client_id, $ord, $title, $url, $description, $state, $paid) = db_get_row('tasks', TASKS_DB_FIELDS, 'where id=%i', $edit_id); tasks_tem_sets($client_id, $ord, $title, $url, $description, $state, $paid); } else { # form not submitted, you can set default values like so: #tem_set('client_id', 'Yes'); } # this has to be later in the file because it requres that client_id be set already if($edit_id) { tem_show('edit_msg'); } elseif($state == TASK_BUG) { tem_show('bug_msg'); } else { tem_show('new_msg'); } } ?>