我正在尝试传递一个双精度值,它们是标签中的数组。如何在另一侧接收和拆分阵列?这是我拥有的代码:
<?php
print("<select name='dsc[]' multiple='multiple' id='searchable-select' multiple>");
//Create new SQL object
$db = new NSC_SQL($db2config);
$db->from($qadbifld, "dbifld, substr(dbitxt,1,25) as FLDTEXT");
$db->where("upper(dbiatr)='PF' and (DBILIB='".$nscmod72d."' or DBILIB='".$aedata72."') ");
$db->group("dbitxt,dbifld");
$db->order("dbitxt,dbifld");
$db->select();
$results = $db->fetchAssoc();
foreach($results as $row)
{
$fieldName = trim($row['DBIFLD']);
$fieldDesc = trim($row['FLDTEXT']);
print("<option VALUE='$fieldDesc,$fieldName'>$fieldDesc - $fieldName </option>");
}
print("</select>");
?>
这就是我试图在另一边接收它的方式:
<?PHP
$dsc = $_POST['dsc'];
list($fieldDesc, $fieldName) = explode(":", $dsc);
//Put the elements of the array in hidden fields here!
print_r($fieldDesc);
print_r($fieldName);
foreach ($fieldDesc as $key => $value1)
{
echo "<input type=hidden name='dsc[]' value='$value1'>";
}
?>
这是用 PHP 编写的
它必须是这种方式,以便只有一个选项被传递给多选框。感谢你们为我提供的任何帮助。