function create_record($recordArray, $termType) { $retXml = new simpleXmlElement("<record />"); if (is_array($recordArray)) { foreach ($recordArray as $key => $value) { // create only when value is defined if ($value) { // if array -> create list if (is_array($value)) { if (intval($value)) { xml_insert($retXml, list_id($key, $value)); } else { xml_insert($retXml, list_name($key, $value)); } } else { // if value -> create tag $retXml->addChild($key, trim($value)); } } } } return $retXml; }
<tr class="MeNewTDLine"> <td align="center" class="SkyTDTopLine" width="100">上课周数</td> <td class="SkyTDLine"><input type="text" name="cou_week_to" value="" /><span class="red_note"> 格式:1-18</span></td> <!-- <td align="center" class="SkyTDTopLine" width="100">授课学院</td> <td class="SkyTDLine"><input type="text" name="teach_school" value="" /></td> --> </tr> <tr class="MeNewTDLine"> <td align="center" class="SkyTDTopLine" width="100">授课教师</td> <td class="SkyTDLine"> <select name="teach_teacher"> <option value="" selected="selected">--请选择--</option> <?php list_name('option', 'user_tea', 'tea_id', 'user_name'); ?> </select> <span class="red_note">*</span> </td> <td align="center" class="SkyTDTopLine" width="100">教材名称</td> <td class="SkyTDLine"><input type="text" name="teachering_material" value="" /></td> </tr> <tr class="MeNewTDLine"> <td align="center" class="SkyTDTopLine" width="100">上课学期</td> <td class="SkyTDLine"> <select name="cou_term"> <option value="" selected="selected">--请选择--</option> <?php list_term(); ?>