$theq .= ColAsInputField("f_last_name") . ','; $theq .= ColAsInputField("f_first_name") . ','; $theq .= ColAsInputField("f_middle_name", '1') . ','; $theq .= ColAsInputField("address") . ','; $theq .= ColAsInputField("city") . ','; $theq .= ColAsInputField("state", '1') . ','; $theq .= ColAsInputField("zip", '3') . ','; $theq .= ColAsInputField("birthday", '6', 'now()', '', 'date') . ','; $theq .= ColAsInputField("start_date", '6', 'now()', '', 'date') . ','; $theq .= ColAsInputField("phone1", '', '', 'placeholder="123-123-1234" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" title="Please user the format 123-123-1234"', 'tel') . ','; $theq .= ColAsInputField("phone1_type", '3', '', 'placeholder="ph type"') . ','; $theq .= ColAsInputField("phone2", '', '', 'placeholder="123-123-1234" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" title="Please user the format 123-123-1234"', 'tel') . ','; $theq .= ColAsInputField("phone2_type", '3', '', 'placeholder="ph type"') . ','; $theq .= ColAsInputField("phone3", '', '', 'placeholder="123-123-1234" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" title="Please user the format 123-123-1234"', 'tel') . ','; $theq .= ColAsInputField("phone3_type", '3', '', 'placeholder="ph type"') . ','; $theq .= ColAsInputField("email", '30', '', '', 'email') . ','; $theq .= " student_type, sex, primary_contact,"; $theq .= "split_part(age(birthday)::text,' ',1)||' '||split_part(age(birthday)::text,' ',2)as age,"; $theq .= "split_part(age(start_date)::text,' ',1)||' '||split_part(age(start_date)::text,' ',2)as trainingage"; $theq .= ' from students s '; $theq .= ' left join sysdef.student_type st on st.short_name=s.student_type '; $theq .= ' where s.stu_index=:stu_index'; try { $pdoquery = $dbconn->prepare($theq); $pdoquery->setFetchMode(PDO::FETCH_OBJ); $pdoquery->execute(array(':stu_index' => $stu_index)); $studentdata = $pdoquery->fetchAll(); $studentdata[0]->stu_index = 'New'; } catch (PDOException $e) { logit($logname, ' **ERROR** on line ' . __LINE__ . ' with query - ' . $theq . ' ' . $e->getMessage()); $results->errortext = $e->getMessage();
updatesysdef("School State", $_POST["schoolstate"], $dbconn, $logname); updatesysdef("School Zip", $_POST["schoolzip"], $dbconn, $logname); updatesysdef("School Phone", $_POST["schoolphone"], $dbconn, $logname); logit($logname, 'going back to school'); header('Location: school.php'); exit; } //school info $theq = 'select '; $theq .= ColAsInputField("schoolname", '30', '', 'required') . ','; $theq .= ColAsInputField("schooladdress", '20', '', 'required') . ','; $theq .= ColAsInputField("schooladdress2", '20') . ','; $theq .= ColAsInputField("schoolcity", '15', '', 'required') . ','; $theq .= ColAsInputField("schoolstate", '1', '', 'required') . ','; $theq .= ColAsInputField("schoolzip", '', '2', 'required') . ','; $theq .= ColAsInputField("schoolphone", '8', '', 'placeholder="123-123-1234" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" title="Please user the format 123-123-1234"', 'tel'); $theq .= ' from crosstab($$'; $theq .= " select 1,replace(sd_item,' ',''),sd_value from sysdef.system_defaults"; $theq .= " where lower(sd_item) in ("; $theq .= " 'school name','school address','school address2',"; $theq .= " 'school city','school state','school zip','school phone')"; $theq .= " \$\$,\$\$"; $theq .= " select 'SchoolName' as seq"; $theq .= " union all select 'SchoolAddress'"; $theq .= " union all select 'SchoolAddress2'"; $theq .= " union all select 'SchoolCity'"; $theq .= " union all select 'SchoolState'"; $theq .= " union all select 'SchoolZip'"; $theq .= " union all select 'SchoolPhone'"; $theq .= " \$\$) as ("; $theq .= " rowid integer,";
$theq .= " login as userlogin,"; $theq .= ColAsInputField('thepassword', '', '', 'required', 'password', 'userthepassword') . ','; } else { //must be a pleb editing someone elses record, dont allow password updating logit($logname, ' this is a pleb editing someone elses data... no edit boxes for login or thepassword'); $theq .= " login as userlogin,'********' as userthepassword,"; } $theq .= ColAsInputField('firstname', '', '', 'required', '', 'userfirstname') . ','; $theq .= ColAsInputField('lastname', '', '', 'required', '', 'userlastname') . ','; $theq .= ColAsInputField('email', '', '', 'required', 'email', 'useremail') . ','; $theq .= ColAsInputField('address1', '', '', '', '', 'useraddress1') . ','; $theq .= ColAsInputField('address2', '', '', '', '', 'useraddress2') . ','; $theq .= ColAsInputField('city', '', '', '', '', 'usercity') . ','; $theq .= ColAsInputField('state', '', '', '', '', 'userstate') . ','; $theq .= ColAsInputField('zip', '', '', '', '', 'userzip') . ','; $theq .= ColAsInputField('phone', '', '', 'placeholder="123-123-1234" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" title="Please user the format 123-123-1234"', 'tel', 'userphone') . ','; $theq .= ' case when locked then \'Disabled\' else \'Enabled\' end as lockeddisplay'; $theq .= ' from users u'; $theq .= ' where userid=:userid'; try { $pdoquery = $dbconn->prepare($theq); $pdoquery->setFetchMode(PDO::FETCH_OBJ); $pdoquery->execute(array(':userid' => $userid)); $userdata = $pdoquery->fetchAll(); } catch (PDOException $e) { logit($logname, ' **ERROR** on line ' . __LINE__ . ' with query - ' . $theq . ' ' . $e->getMessage()); $results->errortext = $e->getMessage(); $cancontinue = FALSE; } if ($userdata[0]->locked == true) { $enabledselected = '';