function SetPreviousValues($s_form_buf, $a_values, $a_strip = array())
{
    //
    // Uncheck any checkboxes and select options
    //
    $s_form_buf = UnCheckStuff($s_form_buf);
    foreach ($a_values as $s_name => $m_value) {
        if (is_array($m_value)) {
            //
            // note that if no values are selected for a field,
            // then we will never get here for that field
            //
            $s_form_buf = FixCheckboxes($s_name, $m_value, $s_form_buf);
            $s_form_buf = FixMultiSelect($s_name, $m_value, $s_form_buf);
        } else {
            //
            // Fix the field if it's an input type "text" or "password".
            //
            $s_form_buf = FixInputText($s_name, $m_value, $s_form_buf);
            //
            // Fix the field if it's radio button.
            //
            $s_form_buf = FixButton($s_name, $m_value, $s_form_buf);
            //
            // Fix the field if it's a "textarea".
            //
            $s_form_buf = FixTextArea($s_name, $m_value, $s_form_buf);
            //
            // Fix the field if it's a "select".
            //
            $s_form_buf = FixSelect($s_name, $m_value, $s_form_buf);
        }
    }
    //
    // Now strip particular field values.
    //
    foreach ($a_strip as $s_name) {
        $s_form_buf = RemoveFieldValue($s_name, $s_form_buf);
    }
    return $s_form_buf;
}
 //
 // For each field do some pattern matching and replacement.
 //
 //
 // first, uncheck any checkboxes and select options
 //
 $sFormBuf = UnCheckStuff($sFormBuf);
 foreach ($aDataArray as $sName => $sValue) {
     //	$sName = StripGPC($sName);	// probably not needed
     //$aDebug[] = "Name='$sName', type=".gettype($sValue);
     if (is_array($sValue)) {
         //
         // note that if no values are selected for a field,
         // then we will never get here for that field
         //
         $sFormBuf = FixCheckboxes($sName, $sValue, $sFormBuf);
         $sFormBuf = FixMultiSelect($sName, $sValue, $sFormBuf);
     } else {
         if ($bStripData) {
             $sValue = StripGPC($sValue);
         }
         //
         // Fix the field if it's an input type "text" or "password".
         //
         $sFormBuf = FixInputText($sName, $sValue, $sFormBuf);
         //
         // Fix the field if it's radio button.
         //
         $sFormBuf = FixButton($sName, $sValue, $sFormBuf);
         //
         // Fix the field if it's a "textarea".