"; } } $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($title, $url, $description, $state, $paid) = db_get_row('tasks', 'title,url,description,state,price', 'where id=%i', $edit_id); tasks_tem_sets($title, $url, $description, $price); } else { # form not submitted, you can set default values like so: #tem_set('client_id', 'Yes'); } # display header if($edit_id) { tem_show('edit_msg'); } elseif($state == TASK_BUG) { tem_show('bug_msg'); } else { tem_show('new_msg'); } # display instructions if($state == TASK_BUG) { tem_show('bug_instructions'); if(logged_in_as_contractor()) { tem_show('price_field'); tem_show('contractor_submits'); } else { tem_show('bug_submit'); } } elseif($state == TASK_NEEDS_QUOTE && logged_in_as_contractor()) { tem_show('set_price_instructions'); tem_show('price_field'); tem_show('contractor_submits'); } else { if(description_has_fixmes($description)) { tem_show('fixme_instructions'); } else { tem_show('normal_instructions'); } tem_show('normal_submits'); } } ?>