I have an issue with my webform after upgrading to the latest version 6.x. Before upgrading there was no issue with the get function now I am missing the name of the departments. Instead of showing the name of the department, it shows the key value. A developer did the webform and I have no idea what he did and what needed to be changed to correct the issue. Below is the code and I have the link of the output drupal.org/files/webform_issue.png of the issue that I am having:
<?php
/* for now, this is for a specific webform. Later it might be the basis for a more general script that can be reused this code is included by php a snippet embedded in a the Meet the Staff node. $nid is hard-coded in the snippet.... $sid is passed in GET if user wants to see data for a single staff person if sid was passed, add and AND clause to the sql
*/
if($_GET['sid']){
$and_clause=' AND s.sid=%d ';
$sid=$_GET['sid'];
}
//we're using the tables from the webforms module
$query= 'SELECT s.*, sd.cid, sd.no, sd.data, c.name
FROM {webform_submitted_data} as sd
LEFT JOIN {webform_component} as c on sd.nid = c.nid AND sd.cid=c.cid
LEFT JOIN {webform_submissions} as s on sd.sid = s.sid
WHERE s.nid = %d '.$and_clause.' ORDER BY nid, sid, sd.cid ';
$result = db_query($query, $nid, $sid); //2nd param will be ignored if not referenced in query
if ($row = db_fetch_object($result)) {
while ($row) {
$data[$row->sid][]=$row;
$row = db_fetch_object($result);
}
}// data is displayed by display order first, then within that by a token made of lname.fname, so build a 3-level array accordingly// NEW: data is sorted by by department first, then within that by display order then within that by a token made of lname.fname, so build a 3-level array a$
foreach ($data as $sid_key=>$sid_array){
foreach ($sid_array as $sid_row){
if ($sid_row->name=='Dept'){
$dept=$sid_row->data;
}
if ($sid_row->name=='Display order'){
$display_order=$sid_row->data;
}
if ($sid_row->name=='Lname'){
$lname=$sid_row->data;
}
if ($sid_row->name=='Fname'){
$fname=$sid_row->data;
}
$temp_array[]=$sid_row;
}
if(!$display_order){$display_order=9999;}//input display order will be 2-digit int, so set to high if none entered $alpha_sort_token=strtolower($lname.$fname);
$sorted_data[$dept][$display_order][$alpha_sort_token]=$temp_array;
unset ($temp_array, $display_order, $alpha_sort_token);
}
ksort ($sorted_data); //sort top array by key, which is the Dept (str)
foreach($sorted_data as $k1=>$v1){
print '<div class="meet_staff_list_dept_header">'.$k1.'</div>';
ksort($v1); //sort each sub-array by key ($display_order)
foreach ($v1 as $k2=>$v2){
ksort($v2); //sort each sub-sub-array by the next key ($alpha_sort_token)
foreach ($v2 as $k3=>$v3){
ksort ($v3);
foreach($v3 as $k4=>$v4){
$one_staffer['sid']= $v4->sid;
$one_staffer[$v4->name]= $v4->data;
}
print '<div class="meet_staff_list_item">';
print ' <div class="meet_staff_list_item_header">';
print "<span class=\"meet_staff_list_name\"><a href=\"?sid=".$one_staffer['sid']."\">".$one_staffer['Fname']." ".$one_staffer['Lname']."</a></sp$
print '</div>';
if($sid){
print '<br><div class="meet_staff_list_item_detail">';
print '<strong>Joined UHC: </strong>';
print $one_staffer['Joined UHC']."<br />n";
print '<br><strong>Education: </strong><br>';
print str_replace("n",'<br>',$one_staffer['Education'])."<br />n";
print '<br><strong>Professional Specialty/Interest: </strong><br>';
print str_replace("n",'<br>',$one_staffer['Professional Specialty/Interest'])."<br />n";
if($one_staffer['What I like']){
print '<br><strong>What I like about working at UHC: </strong><br>';
print str_replace("n",'<br>',$one_staffer['What I like'])."<br />n";
}
print '<br><div class="meet_staff_back_link"><a href="?sid=">< < Back to Full List</a></div>';
print ' </div>';
}
print '</div>';
}
}
}
?>