我有一个数组正在通过如下形式收集:
<select multiple="multiple" name="contractors[]" >
输入代码以将数组保存在数据库中。
$options = $_POST['contractors'];
$serializedoptions = serialize($options);
它以下面的格式将数组保存在数据库中,但我无法正确显示它。当我拉整个它显示:
a:4:{i:0;s:28:Contractor1";i:1;s:15:"Contractor2";i:2;s:10:"Contractor3";}
我怎样才能让它以更易读的格式显示?
$result = mysql_query("SELECT * FROM form_2 GROUP BY jobname");
echo "<table border='1'>
<tr>
<th><font size='1'>Job Name</th>
<th><font size='1'>Contractors</th>
<th><font size='1'>Notes</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td><font size='1'>" . $row['jobname'] . "</font></td>";
echo "<td><font size='1'>" . $row['contractors'] . "</font></td>";
echo "<td><font size='1'>" . $row['notes'] . "</font></td>";
echo "</tr>";
}
echo "</table>";