使用explode()函数将字符串转换成数组
语法:
array eplode(string separator,string string [,int limit ])
<form name="form1" method="post" action="test.php">
<table width="400" border="1" cellpadding="0" cellspacing="1" bordercolor="#FF9900" bgcolor="#CCFF66">
<tr align="center">
<td width="98" height="120">添加投票选项:</td>
<td width="223" height="120"><p>
<textarea name="content" cols="30" rows="5" dir="content"></textarea>
<br />
<span class="style1">注意:每个选项间用*分隔</span></p></td>
<td width="61" height="120"><input type="submit" name="submit" value="提交" /></td>
</tr>
</table>
</form>
<?php
if($_POST[submit]!=""){
$content=$_POST[content];
$data=explode("*",$content);
while(list($name,$value)=each($data)){
echo '<input type="checkbox" name="checkbox" value="chekbox">';
echo $value."\n";
}
}
?>