} if (move_uploaded_file($_FILES[$key]['tmp_name'], $newFileName)) { //set file path to be stored in db $_POST[$key] = $newFileName; } else { $news->errMsg[$key] = "Unable to copy file. Please try again later"; } } else { $news->errMsg[$key] = "Unable to copy file. Please try again later"; } } } } } } else { $opt->errMsg[$key] = "No file specified."; } } } if (!isset($_POST['submit']) || isset($_POST['submit']) && $opt->submitForm(false) == -1) { $optForm = $opt->printForm(); $smarty->assign('opt', $optForm); } else { #$smarty->assign('client_no', $client_no); #submit msg $smarty->assign('updateMsg', $opt->submitMsg); #$content = $smarty->fetch( "./main/allergy/reg_allergy_group.tpl.html" ); #unset prevPath unset($_SESSION['prevPath']); } $content = $smarty->fetch("./pubs/pubs.upload_pub.tpl.html");
$staff->validateField("firstname", "required"); $staff->validateField("lastname", "required"); $staff->validateField("username", "required"); $staff->validateField("password", "required"); #set default values $staff->setDefaultValue('reg_date', date("Y-m-d H:i:s")); $staff->setDefaultValue('change_password', 'Yes'); $staff->setDefaultValue('account_status', 'Active'); //set all output to be returned instead of printed $staff->returnOutput = true; //test for last page and no errors to submit form, otherwise start form if (@$_POST['formitable_multipage'] != "end" || isset($staff->errMsg)) { $staffOpen = $staff->openForm(); $smarty->assign('staffOpen', $staffOpen); } else { $staff->submitForm(false); } //first page - test for no submit OR errors set with a field on the first page if (!isset($_POST['submit']) || isset($staff->errMsg) && isset($_POST['firstname'])) { #print first page $page1 = "page 1"; $smarty->assign('page1', $page1); $id = $staff->printField('identifier'); $smarty->assign('id', $id); $fname = $staff->printField('firstname'); $smarty->assign('fname', $fname); $lname = $staff->printField('lastname'); $smarty->assign('lname', $lname); $reg_date = $staff->printField('reg_date'); $smarty->assign('reg_date', $reg_date); $username = $staff->printField('username');
$newForm->forceTypes(array("foods", "day_of_week"), array("checkbox", "radio")); //get data pairs from another table $newForm->normalizedField("toon", "formitable_toons", "ID", "name", "pkey ASC"); //set custom field labels $newForm->labelFields(array("f_name", "l_name", "description", "pets", "foods", "color", "day_of_week", "b_day", "toon"), array("First Name", "Last Name", "About Yourself", "Your Pets", "Favorite Foods", "Favorite Color", "Favorite Day", "Your Birthday", "Favorite Cartoon")); //set some default values $newForm->setDefaultValue("pets", "Dog"); $newForm->setDefaultValue("color", "Blue"); $newForm->setDefaultValue("toon", "3"); $newForm->setDefaultValue("foods", "pizza,salad"); $newForm->setDefaultValue("day_of_week", date("l")); //set up regular expressions for field validation $newForm->registerValidation("required", ".+", "Input is required."); //set up a field for validation using regex above $newForm->validateField("f_name", "required"); //set validation feedback mode $newForm->feedback = "both"; //retrieve a record for update if GET var set if (isset($_GET['ID'])) { $newForm->getRecord($_GET['ID']); } //call submit method if form has been submitted if (!isset($_POST['submit']) || isset($_POST['submit']) && $newForm->submitForm() == -1) { $newForm->printForm(); } ?> </div> </center> </body></html>
//set up regular expressions for field validation $profile->registerValidation("required", ".+", "Input is required."); //set up fields for validation using regexs above $profile->validateField("firstname", "required"); $profile->validateField("lastname", "required"); #set default values #submit msg $profile->msg_updateSuccess = "Your Profile was updated successfully."; //set all output to be returned instead of printed $profile->returnOutput = true; //test for last page and no errors to submit form, otherwise start form if (@$_POST['formitable_multipage'] != "end" || isset($profile->errMsg)) { $profileOpen = $profile->openForm(); $smarty->assign('profileOpen', $profileOpen); } else { $profile->submitForm(false); } //first page - test for no submit OR errors set with a field on the first page if (!isset($_POST['submit']) || isset($profile->errMsg) && isset($_POST['firstname'])) { #print first page $page1 = "page 1"; $smarty->assign('page1', $page1); $fname = $profile->printField('firstname'); $smarty->assign('fname', $fname); $lname = $profile->printField('lastname'); $smarty->assign('lname', $lname); $end = $profile->multiPage("end"); $smarty->assign('end', $end); $profileClose = $profile->closeForm(); $smarty->assign('profileClose2', $profileClose); } else {
//include class, create new Formitable, set primary key field name include "include/Formitable.class.php"; $myconn = mysql_connect($prDbhost, $prDbusername, $prDbpassword); mysql_query("SET NAMES 'utf8'", $myconn); mysql_query("SET CHARACTER SET 'utf8'", $myconn); // initialize Formitable $newForm = new Formitable($myconn, $prDbname, $prTable); $newForm->setPrimaryKey("id"); // if form has been submitted, call Formitable submit method if (isset($_POST['submit'])) { // if not admin, skip (don't update) the following fields if (!$admin) { $skipped = array('emails1', 'schnip', 'dimo', 'sch1', 'sch2'); $newForm->skipFields($skipped); } $newForm->submitForm(); } else { //retrieve a record for update if GET var is set if (isset($_GET['id'])) { $newForm->getRecord($_GET['id']); } else { die("Error...(no get var)"); } // check if school or admin, else die if (!$admin) { $email = $newForm->getFieldValue('emails1'); if (!strcmp($email, $_SESSION['email1']) || !strcmp($email, $_SESSION['email2'])) { } else { $errormsg = iconv('Windows-1253', 'UTF-8', '<h2>Λάθος. Δεν έχετε δικαίωμα να δείτε αυτό το πρόγραμμα...</h2>'); die($errormsg); }